🔥 Day 13/100 Days Coding Challenge ✅ Problem Solved: Max Consecutive Ones Today’s problem was about finding the maximum number of consecutive 1’s in a binary array. 💡 Key Idea: Traverse the array, count consecutive 1’s, and reset when encountering 0 — while tracking the maximum count. 🧠 What I Learned: Importance of maintaining a running count Using Math.max() efficiently Solving problems in O(n) time with constant space 💻 Approach: Initialize count = 0, max = 0 Loop through array If element is 1 → increment count Else → reset count Update max at each step Consistency is key 🔑 — small steps every day lead to big results! #Day13 #100DaysOfCode #Java #DSA #CodingChallenge #LeetCode #ProblemSolving
Max Consecutive Ones in Binary Array
More Relevant Posts
-
🚀 Day 16/100 Days of Code Challenge Solved the classic “Sort Colors” problem (LeetCode 75) today! 🎯 🔹 Problem Summary: Given an array containing 0s, 1s, and 2s (representing colors), sort them in-place without using built-in sort. 🔹 Approach Used: Maintained three pointers: low, mid, high Efficiently partitioned the array in a single pass 🔹 Key Learning: ✔️ In-place sorting can be done in O(n) time ✔️ Using pointers smartly avoids extra space 💡 Time Complexity: O(n) 💡 Space Complexity: O(1) 🔹 Code Highlight : Used swapping and pointer movement to organize elements in one traversal. Consistency is the key 🔑 — one step closer to mastering DSA! #Day16 #100DaysOfCode #DSA #Java #CodingChallenge #LeetCode #ProblemSolving #TechJourney
To view or add a comment, sign in
-
-
🚀 Day 65 #LeetCode Practice ✅ Problem Solved: Minimum Number Game 💡 What I learned today: • Importance of sorting before processing • Understood how to simulate a game step-by-step • Learned swapping elements in pairs efficiently • Improved thinking on pattern-based array problems 📊 Approach: • First, sort the array • Traverse the array in steps of 2 • Swap every pair of elements • Return the modified array 🧠 Key Insight: Sometimes problems look complex, but after sorting, a simple pattern (pair swapping) solves it easily. 🔥 Consistency is the key! Showing up every day is building my problem-solving mindset step by step. #Day65 #LeetCode #DSA #Java #CodingJourney #Consistency #Learning
To view or add a comment, sign in
-
-
Day 60 of My 90-Day Coding Challenge Today I worked on a classic recursion + backtracking problem — and it really tested how well I understand breaking problems into smaller decisions. At first, it feels messy: multiple partitions, multiple choices, and many possible paths. But once you start thinking in terms of: -“Try every possible cut and validate it” the structure becomes clear. Key learning: • Recursion is about exploring all paths, not rushing to the answer • Validity checks (like palindrome here) are what control the tree • Clean backtracking (add → recurse → remove) is everything One thing that really helped today: Even if you don’t know where to start, just begin drawing the recursion tree. As you expand it step by step, the logic starts revealing itself — what choices to make, when to stop, and how to backtrack. What stood out today: Clarity in recursion doesn’t come from memorizing patterns — it comes from visualizing the process. Still improving. #90DaysOfCode #DSA #Java #Recursion #Backtracking #LeetCode #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 60 — LeetCode Practice 🚀 ✅ Problem Solved: Kth Missing Positive Number 💡 What I learned today: • Understood how to find missing numbers in a sorted array • Learned how to compare expected vs actual values • Practiced reducing k step by step to reach the answer • Realized that simple looping logic can solve tricky problems 📊 Approach: • Start from number 1 and compare with array • If number is missing → decrease k • If number is present → move pointer • When k becomes 0 → that number is the answer ⏱ Time Complexity: O(n + k) 📦 Space Complexity: O(1) This problem improved my thinking about sequences and missing elements 🔥 Consistency is the key — Day 60 done! 💪✨ #Day60 #LeetCode #DSA #Java #CodingJourney #KeepGoing
To view or add a comment, sign in
-
-
🚀 Day 58 — LeetCode Practice 🚀 Today’s problem: Shuffle String (LeetCode 1528) 💡 Key Learning: • Learned how to rearrange characters using index mapping • Understood how placing elements at correct positions simplifies the problem • Practiced writing clean and efficient O(n) solutions • Strengthened thinking for array + string manipulation 🧠 Approach in simple words: Instead of modifying the original string, create a new array and place each character at its correct index using the given indices. ✨ Takeaway: Sometimes the simplest idea — “put the element in its right place” — gives the most optimal solution. Consistency is the real game 💪 #Day58 #LeetCode #DSA #CodingJourney #Java #Consistency #ProblemSolving
To view or add a comment, sign in
-
-
🔥 Day 57/100 Today’s problem was all about smart string merging using Dynamic Programming 💡 👉 Problem: Minimize the final string length after performing join operations with overlap conditions. 🧠 Key Learning: Instead of building the full string (which is costly), I learned to optimize by tracking only: - First character - Last character - Current length This reduced the complexity drastically and made the solution efficient ⚡ 💻 Concepts Used: - Dynamic Programming (DP) - State Optimization - Greedy Thinking + Decision Making ✨ Takeaway: Sometimes, you don’t need the entire data — just the important parts to make decisions. Consistency > Motivation 🚀 See you on Day 58! #Day57 #Java #DSA #CodingJourney #PlacementPrep #LearnInPublic #100DaysOfCode
To view or add a comment, sign in
-
-
LeetCode Challenge – Day 13 Today I solved Problem 13: Roman to Integer (Easy). Roman numerals use seven symbols Roman numerals are usually written from largest to smallest. But when a smaller numeral appears before a larger one, we subtract it instead of adding it. Approach: Store Roman numeral values in a HashMap. Traverse the string from left to right. If the current value is less than the next value → subtract it. Otherwise → add it to the result. Time Complexity: O(n) Space Complexity: O(1) Practicing problems daily helps strengthen problem-solving and coding skills. #LeetCode #Day13 #Java #CodingChallenge #ProblemSolving #Programming #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 99 - #100DaysOfCode Today’s problem: Left and Right Sum Differences 💡 Approach: Instead of recalculating everything from scratch, I optimized the solution by: Keeping a running leftSum Calculating rightSum dynamically for each index Using Math.abs() to get the absolute difference 🧠 Key Learning: Maintaining a running sum significantly improves efficiency and avoids redundant calculations. #Day99 #CodingJourney #Java #DSA #LeetCode #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🔥 Day 36 of #LeetCode Journey ✅ Problem: Minimum Distance Between Three Equal Elements I Today’s problem was about finding the minimum distance between three equal elements in an array. 💡 Key Idea: Instead of checking all combinations, we track indices efficiently: Store the last two occurrences of each number When a third occurrence appears, calculate the distance Keep updating the minimum distance 🧠 What I Learned: Optimizing from brute force to O(n) approach Using HashMap effectively for tracking indices Thinking in terms of patterns instead of combinations ⚡ Time Complexity: O(n) ⚡ Space Complexity: O(n) 🔍 Example: Input: [1,2,1,1,3,1] Output: 3 Small optimizations make a big difference 💡 Staying consistent and improving every day! #Java #DSA #LeetCode #CodingJourney #100DaysOfCode #Programming #ProblemSolving
To view or add a comment, sign in
-
-
Day 8/30 of my #30DaysDSAChallenge 🚀 Solved Problem 70 on LeetCode: Climbing Stairs 🧗♂️ At first glance, it looks simple — but the real learning was in identifying the pattern. This problem is a classic example of how Dynamic Programming works behind the scenes. 💡 Key Insight: To reach step n, you can either come from n-1 or n-2. Which leads to a Fibonacci-like relation: 👉 ways(n) = ways(n-1) + ways(n-2) Instead of using recursion (which is inefficient), I implemented an optimized iterative approach with O(n) time and O(1) space. 📚 What I learned today: Recognizing DP patterns in problems Converting recursion → optimized iteration Importance of space optimization Small steps every day, but getting stronger with problem-solving 💪 #DSA #LeetCode #Java #ProblemSolving #CodingJourney #Consistency #100DaysOfCode
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development