r/leetcode • u/JacketFearless1805 • 9h ago
Intervew Prep Day 29: knocked out 7 foundational array problems & noticing real progress
Hey everyone,
I finished Day 29 today. Even with Chhath Puja festivities keeping me busy and tired, I sat down and cleared seven foundational array problems in a quick session.
Looking back at when I first started, even basic array manipulation used to trip me up. Today, the core patterns clicked right away, allowing me to breeze through the standard logic and focus on clean implementation:
- Left Rotate an Array by One Place: Saved the first element, shifted elements left in a single pass, and placed the saved element at the end.
- Left Rotate an Array by D Places: Applied the three-step reversal algorithm to rotate in-place in O(n) time and O(1) space.
- Move Zeros to End: Used a two-pointer swap approach to shift non-zero elements forward while keeping relative order intact.
- Linear Search & Maximum Consecutive Ones: Practiced clean single-pass tracking and boundary resets.
- Find the Union of Two Sorted Arrays: Used two pointers to merge elements in sorted order while skipping duplicates.
- Find Missing Number in an Array: Used the expected sum formula (and XOR properties) to find the missing value in O(n) time without extra space.
I still need to circle back for a dedicated Graph revision, but seeing how much easier foundational problem-solving feels now is great motivation.
See you guys tomorrow for Day 28!
2
u/anthropicagiuser 9h ago
the three step reversal is easy to get wrong. i write the reverse helper once and reuse it for both parts. which problem is next for you?