-
30 Days of Code [Day 21]
QUESTION : 70. Climbing Stairs #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define fo(i,s,n) for(int i=s;i<n;++i) #define of(i,s,n) for(int i=s-1;i>=n;--i) #define fv(V) for( auto &it : V ) #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); class Solution { public: int climbStairs(int n)...
-
30 Days of Code [Day 20]
QUESTION : Shuffling Parities Problem Code: SHUFFLIN #include<bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define vi vector<int> #define vvi vector<vi> #define vl vector<long> #define vvl vector<vl> #define pii pair<int, int> #define pll pair<long, long> #define endl "\n" #define fo(i,s,n) for(int i=s;i<n;++i) #define of(i,s,n) for(int i=s-1;i>=n;--i)...
-
30 Days of Code [Day 19]
QUESTION : 406. Queue Reconstruction by Height #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define fo(i,s,n) for(int i=s;i<n;++i) #define of(i,s,n) for(int i=s-1;i>=n;--i) #define fv(V) for( auto &it : V ) #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); class Solution { public: vector<vector<int>>...
-
30 Days of Code [Day 18]
QUESTION : 1475. Final Prices With a Special Discount in a Shop #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define fo(i,s,n) for(int i=s;i<n;++i) #define of(i,s,n) for(int i=s-1;i>=n;--i) #define fv(V) for( auto &it : V ) #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);...
-
30 Days of Code [Day 17]
QUESTION : 1310. XOR Queries of a Subarray #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define fo(i,s,n) for(int i=s;i<n;++i) #define of(i,s,n) for(int i=s-1;i>=n;--i) #define fv(V) for( auto &it : V ) #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); class Solution { public:...
-
30 Days of Code [Day 16]
QUESTION : 899. Orderly Queue #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define fo(i,s,n) for(int i=s;i<n;++i) #define of(i,s,n) for(int i=s-1;i>=n;--i) #define fv(V) for( auto &it : V ) class Solution { public: string orderlyQueue(string s, int k) { if(k >...
-
30 Days of Code [Day 15]
QUESTION : 215. Kth Largest Element in an Array #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define fo(i,s,n) for(int i=s;i<n;++i) #define of(i,s,n) for(int i=s-1;i>=n;--i) #define fv(V) for( auto &it : V ) class Solution { public: int findKthLargest(vector<int>& nums, int...
-
30 Days of Code [Day 14]
QUESTION : 844. Backspace String Compare #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define fo(i,s,n) for(int i=s;i<n;++i) #define of(i,s,n) for(int i=s-1;i>=n;--i) #define fv(V) for( auto &it : V ) class Solution { public: bool backspaceCompare(string s, string t) { int...
-
30 Days of Code [Day 13]
QUESTION : 40. Combination Sum II #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define fo(i,s,n) for(int i=s;i<n;++i) #define of(i,s,n) for(int i=s-1;i>=n;--i) #define fv(V) for( auto &it : V ) class Solution { public: set<vi> res; vector<vector<int>> combinationSum2(vector<int>& candidates, int target)...
-
30 Days of Code [Day 12]
QUESTION : 39. Combination Sum #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define fo(i,s,n) for(int i=s;i<n;++i) #define of(i,s,n) for(int i=s-1;i>=n;--i) #define fv(V) for( auto &it : V ) class Solution { public: void helper(vi &candidates, vector<vi>& res, vi v, int...