Solved 3 LeetCode problems, learned valuable DSA skills

🚀 Leveling Up with LeetCode — 3 Problems, 3 Learnings 💡 Over the past few days, I’ve been sharpening my DSA skills through some interesting problems on LeetCode. Each one gave me a new perspective on problem-solving and pattern recognition. Here’s a quick breakdown 👇 🔹 1️⃣ Max Consecutive Ones Concept: Counting consecutive 1s using a simple loop. Learning: How to maintain running counts and track maximum streaks efficiently. 🧠 Key idea: Reset count to 0 when a 0 appears, and use Math.max() to update the longest streak. 🔹 2️⃣ Next Greater Element I Concept: For every element in nums1, find the next greater element in nums2. Learning: Nested traversal helps understand how comparisons and indexing work. 🧠 Key idea: Break loops efficiently once the next greater element is found. 🔹 3️⃣ Array Partition Concept: Pair up integers to maximize the sum of minimums. Learning: Sorting plays a crucial role in greedy problems. 🧠 Key idea: After sorting, take every alternate element (since it’ll always be the smaller one in each pair). 💻 Languages/Concepts Used: Java, Arrays, Sorting, Loops, Greedy approach. 📈 Complexity: Most solutions optimized to O(N log N) or better. I’m continuously improving my DSA understanding and consistency on LeetCode — each problem adds a new layer to my logical thinking and confidence. 👉 You can check out my profile here: 🔗 https://lnkd.in/gFH_4R9a #LeetCode #Java #DSA #CodingJourney #ProblemSolving #LearningEveryday #Programming #AmanSingh

To view or add a comment, sign in

Explore content categories