DEV Community

Vrinda Khandelwal
Vrinda Khandelwal

Posted on

๐ŸŒŸ Day 2 โ€“ Arrays Advanced (My 150 Days of DSA Journey)

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)