Day 18 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Permutations of a string
Q2) N Queens
Q3) Sudoku Solver
Both 2 and 3 have similar structure, just selection logic differs. Classic recursion questions today.
@mightysimran@takeUforward_@striver_79 You can try the variation of this question where there are duplicates in the array, it took me a while to get that.
Day 17 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Combination Sum : including duplicates
Q2) Combination Sum II : unique subsets only
Q3) Palindrome partitioning : check each index for palindrome
Q4) Permutation Sequence : used math soln
A bit late due to exams :(
Day 15 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Minimum Coins : 1D DP ; greedy fails due to non uniform data
Q2) Assign cookies : simple greedy
Q3) Subset Sum equals target : 2D DP
Q4) Subsets II : Recursion + duplicate removal
Learned DP for the first time today!
Day 15 of #SDESheetChallenge@striver_79@takeUforward_
Q1) N Meetings : Sort meetings according to end time Q2) Min Platforms : sort both arrival and departure
Q3) Job Sequencing : Try to push the most profitable option to the last
Q4) Fractional Knapsack : weight/val ratio
Day 14 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Trapping Rainwater : imq ques, had to look up soln.
Q2) Remove duplicates : keep moving the unique elements to the front
Q3) Consecutive ones : easiest one till now
Couldn't revise today, will try later :(
Day 13 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Rotate LL : Did on my own, apart from an edge case.
Q2) Clone LL : Had to look up solution, creative approach.
Q3) 3Sum : 3 pointers technique, had some revision from doing 4Sum.
While it is important to practice questions everyday, it is more important to revise what you have practiced, that's why i will try revising the hard problems i faced tomorrow.
#SDESheetChallenge
Day 12 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Check Palindrome : Reverse the 2nd half of the LL, and then two-ptr.
Q2) Starting point in LL : direct slow-fast
Q3) Flattening a LL : Recursion + merge 2 LL, will have to revise later.
2 quite easy ones, and one hard.
Day 11 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Find Intersection of LLs : had to refer optimal, did brute & better
Q2) Detect Loop : direct slow-fast method
Q3) Reverse L in pairs of k : Hard one. Reverse subsets of size k and join. Feels intuitive but hard to code
Day 9 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Remove Nth node from back: Two pointer approach
Q2) Add two numbers in LL : straightforward
Q3) Delete Node in LL : took me some time to understand lol, pretty easy in the end
Did late due to lab exams, tiring day.
Day 9 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Reverse LL : Needed to revise both iterative and recursive soln
Q2) Find middle of LL : straight-forward slow-fast application
Q3) Merge two Sorted Lists : use 2 pointers at start of each list and compare
Day 8 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Longest subarray with sum k : Classic prefix sum(had to revise)
Q2) Count subarrays with xor k : forgot xor logic
Q3) Longest Substring w/o Repeating Chars: simple sliding window, did on my own
Day 7 of #SDESheetChallenge@striver_79@takeUforward_
Q1) 2Sum - Classic hashmap
Q2) 4Sum - 4 pointer approach, 2 pointers converge while 2 stay constant, similar to 3Sum.
Q3) Longest Consecutive Sequence : Use set to count consecutive elements.
Day 6 of #SDESheetChallenge@striver_79@takeUforward_
Q1) Majority Element II - Used 2 elements and count vars
Q2) Grid Unique Paths - Did NCr formula instead of DP solution, cuz i haven't done DP yet
Q3) Reverse Pairs - Another Merge sort variation π (No chance doing on spot)
oof.. this is the kinda question, which u need to keep doing or else, after a while you have no clue what's going on.
Not that its very hard, but i could only do it cuz i did a few similar problems in a row.