Skip to content

Instantly share code, notes, and snippets.

class Solution {
public:
int climbStairs(int n) {
if(n <= 2) return n;
int a = 1;
int b = 2;
int result = 0;
class Solution {
public:
string simplifyPath(string path) {
int len = path.length();
string result;
if(len == 0) return result;
class Solution {
public:
int minDistance(string word1, string word2) {
if(word1.length() == 0) return word2.length();
if(word2.length() == 0) return word1.length();
int len1 = word1.length();
int len2 = word2.length();
class Solution {
public:
void setZeroes(vector<vector<int> > &matrix) {
int row = matrix.size();
if(row == 0) return;
int col = matrix[0].size();
class Solution {
public:
bool searchMatrix(vector<vector<int> > &matrix, int target) {
int row = matrix.size();
if(row == 0) return false;
int col = matrix[0].size();
int x = 0; int y = col -1;
class Solution {
public:
void swap(int & a, int & b) {
int temp = a;
a = b;
b = temp;
}
void sortColors(int A[], int n) {
int first = 0;
int second = n - 1;
class Solution {
public:
string minWindow(string S, string T) {
string result;
int s = S.length();
int t = T.length();
if(s == 0 || t == 0) return result;
map<char, int> need;
class Solution {
public:
vector<vector<int> > combine(int n, int k) {
vector<vector<int> > results;
vector<int> entry;
combineHelper(n, k, entry, results, 1);
return results;
}
class Solution {
public:
vector<vector<int> > subsets(vector<int> &S) {
sort(S.begin(), S.end());
vector<int> entry;
vector<vector<int> > results;
class Solution {
public:
int getithBit(int n, int i) {
return n & 1<<i;
}
vector<vector<int> > subsets(vector<int> &S) {