This file contains hidden or 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 <unordered_map> | |
using namespace std; | |
struct Node | |
{ | |
int data; | |
struct Node *next; | |
Node(int data) |
This file contains hidden or 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; | |
struct Node | |
{ | |
int data; | |
struct Node *left; | |
struct Node *right; | |
}; |
This file contains hidden or 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; | |
int minCostToEndRecursion(int arr[], int size, int k) | |
{ | |
int result = INT_MAX; | |
if (size < 0) | |
{ | |
return 0; |
This file contains hidden or 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 <list> | |
using namespace std; | |
class Vertex { | |
public: | |
int data; | |
list<pair<int, Vertex> > edges; | |
Vertex() { |
This file contains hidden or 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; | |
bool isPalindromIterative(char *inp, int len) | |
{ | |
for (int i = 0; i < len / 2; i++) | |
{ | |
if (inp[i] != inp[len - 1 - i]) | |
{ |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#include <stack> | |
void swap(char *a, char *b) | |
{ | |
char temp = *a; | |
*a = *b; | |
*b = temp; | |
} |
This file contains hidden or 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; | |
int max(int a, int b, int c) | |
{ | |
return max(a, max(b, c)); | |
} | |
int longestPalindromSubseqRecur(char arr[], int len, int start, int end) |
This file contains hidden or 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; | |
void printSubsequences(string inp, string subs) | |
{ | |
if (inp.length() == 0) | |
{ | |
cout << subs << endl; | |
return; |
This file contains hidden or 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; | |
int longestCommonSubseqRec(char arr1[], char arr2[], int len1, int len2) | |
{ | |
if (len1 == 0 || len2 == 0) | |
{ | |
return 0; | |
} |
This file contains hidden or 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; | |
int countSubsetSumEqualsGivenSumRec(int arr[], int size, int sum) | |
{ | |
if (sum < 0 || size < -1) | |
{ | |
return 0; | |
} |