Day 26 of #SDESheetChallenge
Next Smaller Element - ✅
LRU Cache - ✅
LFU Cache - ❌
I was able to solve Next Smaller Element and LRU Cache. But LFU Cache was on another level—I couldn't code it even after going through the solution. Definitely one of the toughest design problems I've encountered so far. 💀
One thing that confused me was why the LRU Cache problem is placed under the Stacks & Queues section. 🤔 I actually spent 5–10 minutes trying to think of a stack/queue-based approach before realizing it was all about a Doubly Linked List + HashMap.
@takeUforward_@striver_79 #LeetCode #45DaysChallenge
Day 23 of #SDESheetChallenge
Find Median from Data Stream - X
Merge K Sorted Arrays - tick mark
Top K Frequent Elements - tick mark
For first question, I saw an article in gfg, it is pretty easy, but I didn't come with the solution. Coming to 2nd and 3rd questions, they are pretty straight forward questions.
@takeUforward_@striver_79 #45DaysChallenge #Leetcode #tuf
Day 22 of #SDESheetChallenge
✅ Implement Max Heap
✅ K-th Largest Element in an Array
❗ Maximum Sum Combination
Revisited heap implementation concepts from GFG for the first question. The second one was pretty straightforward.
For Maximum Sum Combination, I got a few hints from ChatGPT, which helped me arrive at the solution. Another good problem to strengthen heap and set concepts.
@takeUforward_@striver_79
#45DaysChallenge #LeetCode #DSA #SDESheetChallenge
Day 21 of #SDESheetChallenge
❌ Median of 2 Sorted Arrays
✅ Kth Element of 2 Sorted Arrays
❌ Allocate Minimum Number of Pages
✅ Aggressive Cows
Couldn't solve the 1st and 3rd questions previously, because It was hard for me understand these questions at that point of time. But glad that able to understand them now after watching the videos and applied them to solve the 2nd and 4th questions, which follow similar patterns.
A reminder that even when you don't solve a problem, learning the approach can pay off immediately.
@takeUforward_@striver_79
#DSA #LeetCode #SDESheetChallenge
Day 20 of #SDESheetChallenge
✅ N-th Root of an Integer
❌ Matrix Median
✅ Single Element in a Sorted Array
✅ Search in a Sorted and Rotated Array
A decent day with 3/4 problems solved on my own. Couldn't solve Matrix Median. I got the idea for it, but I was not able to code it.
@takeUforward_@striver_79
#DSA #LeetCode #SDESheetChallenge
Day 19 of #SDESheetChallenge
❌ M-Coloring Problem
✅ Rat in a Maze
❌ Word Break
Solved only Rat in a Maze on my own today.
Got a solution for Word Break, but it ran into TLE. By the time I reached M-Coloring, I was already tired, so I looked at the approach and implemented it.
@takeUforward_@striver_79
#DSA #LeetCode #SDESheetChallenge
Day 18 of #SDESheetChallenge
✅ Permutations of a String
✅ N-Queens
✅ Sudoku Solver
A satisfying day of backtracking problems!
I had attempted the Permutations problem before on LeetCode but couldn't solve it then. Today, I was finally able to solve it completely on my own, which felt really rewarding.
Coming to the N-Queens problem, I was surprised that I got it right on the very first attempt without any bugs or code changes. That definitely boosted my confidence.
@takeUforward_@striver_79
#DSA #LeetCode #SDESheetChallenge #45DaysOfCode
Day 17 of #SDESheetChallenge
✅ Combination Sum
❌ Combination Sum II
✅ Palindrome Partitioning
❌ Permutation Sequence
Combination Sum II felt very similar to the first problem, but with the extra challenge of handling duplicate elements efficiently. I wasn't able to come up with the complete solution on my own.
For Permutation Sequence, I could solve it recursively, but it resulted in TLE. After watching Striver's video, the optimized logic completely blew me away.
Overall, some wins, some misses, and a couple of great learnings.
@takeUforward_@striver_79
#DSA #LeetCode #SDESheetChallenge #45DaysOfCode
Day 16 of #SDESheetChallenge
✅ Minimum Coins
✅ Assign Cookies
✅ Subset Sum
✅ Subsets II
Glad that I was able to solve all the questions on my own today.
Interestingly, the Minimum Coins problem was asked in my Harness interview. I remember taking around 5 minutes to arrive at the solution because I kept thinking in a greedy direction. Eventually, I was able to solve it correctly.
Unfortunately, I couldn't clear the next round, but the experience taught me a lot.
@takeUforward_@striver_79
#DSA #LeetCode #SDESheetChallenge #45DaysOfCode
📅 Day 14 of #SDESheetChallenge
☹️ Trapping Rainwater
✅ Remove Duplicates from Sorted Array
✅ Maximum Consecutive Ones
A hard day for problem solving. 😓
I know I've solved Trapping Rainwater before, but I couldn't come up with the logic again. Need to see the hint to get the solution.
For Remove Duplicates from Sorted Array, I managed to solve it, but not with the optimal approach.
@takeUforward_@striver_79
#SDESheetChallenge #DSA #LeetCode #Arrays #ProblemSolving
Day 13 of #SDESheetChallenge
Rotate a LL - ✅
Clone a LL with random and next pointer - ‼️
3 sum - ✅
Able to solve rotate LL and 3 sum 😏 on my own. For rotate Linked list, It's like a brute force. Initially I thought there might be another solution for it, but mine is best solution you can go with. 3 sum straight forward like four sum we have done before but this time with 3 pointers.
Coming to 2nd question. I got the idea of hash map, but I didn't code it thinking there will be optimal solution for it. Then saw the video, as usual I stunned with the solution. Placing the nodes in between the original videos, what a thought. But coming to coding the optimal solution for the 2nd question, it took me about 40 min. But able to code it.
@takeUforward_@striver_79
📅 Day 12 of #SDESheetChallenge
✅ Check if Linked List is Palindrome
✅ Find the Starting Point of Loop in Linked List
✅ Flattening of Linked List
A satisfying day of problem solving!
Managed to solve all three questions and with this, completed the Linked List Part-II section.
Overall, a great coding session to start the day with.
@takeUforward_@striver_79
#SDESheetChallenge #DSA #LeetCode #LinkedList #ProblemSolving
📅 Day 11 of #SDESheetChallenge
✅ Find the Intersection Point of Y Linked Lists
✅ Detect a Loop in Linked List
⚠️ Reverse Linked List in Groups of K
I was able to solve the first two questions on my own.
But the third one really tested my understanding. I couldn't figure it out initially, so I watched @striver_79's video twice. The second watch gave me the clarity I needed, and I finally understood the approach.
A tough day for problem solving.
@takeUforward_@striver_79
#SDESheetChallenge #DSA #LeetCode #LinkedList #ProblemSolving
📅 Day 10 of #SDESheetChallenge
✅ Remove Nth Node From Linked List
✅ Add Two Numbers as Linked List
⚠️ Delete Node in a Linked List
The first problem was solved using the two-pointer approach. For the second one, it was mostly straightforward traversal.
The third problem caught me off guard. I couldn't solve it initially, but after seeing the solution, my first reaction was, "That's so simple!" 😅. Copying the value of next node and skipping the next node.
One doubt I had: if the node to be deleted is the tail, can we simply do node = nullptr? 🤔
@takeUforward_@striver_79
#SDESheetChallenge #DSA #LeetCode #LinkedList #ProblemSolving
📅 Day 9 of #SDESheetChallenge
✅ Reverse a Linked List
✅ Find Middle of Linked List
✅ Merge Two Sorted Linked Lists
A good day for problem solving!
The first problem was pretty straightforward and took only about 3 minutes.
For the second one, I used the Rabbit and Tortoise (Fast & Slow Pointers) approach. 🐇🐢
The third problem took around 10–15 minutes. I got the logic immediately, but writing the code correctly took some time. I managed to solve it in-place without creating a new linked list, which is exactly how @striver_79 intended it to be solved.
Overall, a satisfying coding session to kick off the day😌
@striver_79@takeUforward_
#SDESheetChallenge #DSA #LeetCode #LinkedList #ProblemSolving