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)