Sanjeev Kumar’s Post

🚀 Day 4 of My LeetCode Journey — Building Problem-Solving Muscle Today I worked on two problems: 🔹 Max Consecutive Ones (LeetCode 485) 🔹 Missing Number (LeetCode 268) 💡 Problem 1: Max Consecutive Ones This problem is all about pattern recognition. 👉 Traverse the array 👉 Keep counting consecutive 1s 👉 Reset when you hit 0 Simple logic, but a great reminder that not every problem needs complex data structures. 💡 Problem 2: Missing Number This one was interesting — multiple ways to solve it: ✔️ Sorting ✔️ HashSet ✔️ XOR ✔️ Sum formula (most optimal) The cleanest approach: 👉 Use the formula: n * (n + 1) / 2 👉 Subtract the actual sum 👉 Boom — missing number found ⚡ 🔥 Key Takeaways from Today: Not every problem needs brute force There’s always a more optimal way — look for patterns Understanding multiple approaches = stronger fundamentals Consistency is slowly turning confusion into clarity 💪 On to Day 5 🚀 #LeetCode #DataStructures #Algorithms #CodingJourney #100DaysOfCode #SoftwareEngineering #Programming #InterviewPrep #JavaScript #CodingLife #TechGrowth #ProblemSolving #Developers #LearnToCode #Consistency #CodeNewbie #DailyCoding

To view or add a comment, sign in

Explore content categories