This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <math.h> | |
#define TOTAL 26 | |
/* | |
Logic | |
Lets take the example of "A B C" | |
Let answer = 0 | |
Our String size is 3. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This only take int data type and input. | |
//More inprovment can be done, example in helper we can use binary search. | |
#include <iostream> | |
#include <vector> | |
std::vector<int> getPairs(int num) | |
{ | |
std::vector<int> pairs; | |
while(num){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
//---------------Function Declaration---------------- | |
void error(std::string); // returns error | |
bool valid_temp(double); // check for valid temprature in Kelvin | Below 0K is invalid | |
double ctok(double); // convert Celsius to Kelvin | |
double ktoc(double); // convert Kelvin to Celsius | |
double ftoc(double); // convert Fahrenheit to Celsius | |
double ctof(double); // convert Celsius to Fahrenhiet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// problem link : https://www.hackerrank.com/challenges/attribute-parser/problem | |
#include <iostream> | |
#include <vector> | |
const int start = 1; | |
const int end = 0; | |
//------------User defined Data types ---------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The grammar for input is: | |
Calculation : | |
Statement | |
Quit | |
Calculation Statement | |
Statement: | |
Declaration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Programming Principles and Practice Using C++ : Bjarne Stroustrup | |
// Chapter 6 | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
// class Token_stream; // member functionss : putback(), get() | |
// class Token; // Token class, member varaibles : kind, value; | |
double expression(); // Exp = Exp or Exp + Term or Exp - term |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Script to extract Multiple RAR files and place each RAR file's content in its own directory | |
for z in *.rar | |
do | |
# removing all white space. Generating Directory name | |
c="$(echo -e "${z}" | tr -d '[:space:]')" | |
# Creating directory. Replace <Directory Address> with your own Directory Address. | |
mkdir /<Directory Address>/$c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Python code for this problem : https://gist.github.com/jatinsharrma/e64bfbe225d9d97d770873d4700e5765 | |
// This program is based on Operator Precedence Parser concept. | |
var lastNumeric : Boolean = false | |
var lastDot : Boolean = false | |
var stack = ArrayList<String>() | |
var parCount : Int = 0 | |
var parFlag : Boolean = false | |
var wrongFlag : Boolean = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-------------------------------------------------------------------- | |
#--------------Mathematical Expresion Evaluater---------------------- | |
#-------------------------------------------------------------------- | |
'''Logic: | |
this program makes use of the operator precedence parser concept. | |
(An operator precedence parser is a Compiler Design Concept) | |
There are checkpoint you can uncomment those to see how code is running |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# //////////////////////////////////////////////// | |
# --------------Three Number Sum----------------- | |
# /////////////////////////////////////////////// | |
# time complexity O(n^2) | |
# space complexity O(n) | |
def tripletSum(arr, v): |
NewerOlder