Hey folks ๐
Today was Day 2 of my 150 Days of DSA Challenge, and honestly, this one felt like leveling up a bit compared to yesterday. The problems were trickier, more about thinking than just applying a formula. But thatโs the fun part, right? ๐
๐ฅ What I solved today
1๏ธโฃ Maximum Product Subarray (152)
This one was a rollercoaster.
At first, I thought, โOkay, just keep multiplying, whatโs the big deal?โ but then negative numbers entered the chat ๐
.
The trick is: keep track of both the current max and min product, because a negative can flip the game.
2๏ธโฃ Search in Rotated Sorted Array (33)
Classic interview problem!
Itโs like binary search, but the array is all โrotated and twisted.โ At least one side is always sorted, so the goal is figuring out which side to search in. Once you see that pattern โ itโs smooth sailing. ๐ค
3๏ธโฃ Merge Intervals (56)
This felt kind of satisfying. You just sort all the intervals, then keep merging overlapping ones.
Itโs like organizing a messy calendar into one neat schedule. ๐
4๏ธโฃ First Missing Positive (41)
๐ฅ This one was tough.
The idea is to put every number at its โcorrect indexโ (like num should be at index = num-1). After rearranging, the first mismatch gives the answer. It took me a little while to get the intuition, but once it clicked, it felt magical โจ
5๏ธโฃ Longest Consecutive Sequence (128)
Since Iโm avoiding hash maps for now, I solved it with sorting.
Basically sort the array and just count streaks of consecutive numbers. Not the most optimal way, but it worked and gave me more clarity.
๐ญ Reflections
Todayโs set pushed me out of my comfort zone.
I realized how much small tricks (like swapping min/max for negatives, or sorting before merging) can completely change the difficulty of a problem.
Iโm actually starting to enjoy debugging my own wrong thoughts before hitting โRunโ ๐
๐ Next Steps
Tomorrow Iโll be moving to strings and palindrome problems.
Iโm excited (and a bit scared) but thatโs exactly why Iโm doing this 150-day challenge โ to push myself daily.
Thanks for reading! ๐
If youโre also grinding DSA, letโs connect and cheer each other on. ๐ช
๐ This was my Day 2 update. On to Day 3 tomorrow!
Top comments (0)