#LeetCode 76: Minimum Window Substring – A Masterclass in Logic. I used to think I knew Sliding Window, but this Hard-level problem challenged my assumptions. It’s less about the loop and more about the order of operations. I learned that updating the minimum window at the wrong micro-step can lead to hours of debugging. It was a solid reminder that in technical interviews and real-world dev, small conditions can silently break correct-looking logic. Focus on the logic; the code will follow. #Coding #Java #LearningToCode #DataStructures #SlidingWindow
Mastering Sliding Window Logic with LeetCode 76
More Relevant Posts
-
Day 4 – LeetCode 345 | Reverse Vowels of a String | Two Pointers Description: Continuing Day 4 of my LeetCode practice with LeetCode 345: Reverse Vowels of a String. Used the Two Pointer approach to scan from both ends, swap only vowels, and leave all other characters untouched. This avoids extra space and keeps the solution efficient. Time Complexity: O(n) Space Complexity: O(1) Key learnings: • Identifying when two pointers beat brute force • Clean character swapping logic • Handling edge cases without using unnecessary libraries Discipline beats talent. More problems coming. Tags: #LeetCode #Day4 #TwoPointers #Strings #ProblemSolving #Java #DSA #CodingJourney
To view or add a comment, sign in
-
Solved LeetCode 21 – Merge Two Sorted Lists ✅ Implemented an efficient solution using the two-pointer technique on linked lists. Focused on: Clean pointer manipulation Avoiding extra space Writing readable and optimized code 📌 Time Complexity: O(n + m) 📌 Space Complexity: O(1) (in-place merge) Consistent DSA practice to strengthen fundamentals and problem-solving skills 🚀 #DSA #LinkedList #LeetCode #Java #ProblemSolving
To view or add a comment, sign in
-
-
📐 Jagged Arrays. A jagged array means: ✅ Different rows can have different number of columns ✅ int[][] arr = new int[rows][]; → only rows fixed ✅ each row can have different columns ✅ arr[i].length will be different for different rows GitHub Link: https://lnkd.in/g6JtkYCA 🔖Frontlines EduTech (FLM) #Java #Arrays #DeepCopy #ShallowCopy #2DArray #JavaProgramming #Coding #DSA #ProgrammingBasics #LearnJava #CodeSnippet
To view or add a comment, sign in
-
-
Day 18 of #100DaysOfCode 🚀 📌 Problem: Isomorphic Strings (LeetCode) 💡 Key Learning: ▪️Two strings are isomorphic if there’s a one-to-one character mapping that stays consistent throughout. 🔍 What I focused on today: ▪️Using HashMap to store character mappings ▪️Ensuring no two characters map to the same value ▪️Understanding the importance of correct if–else structure ▪️Why checking string length first matters ▪️How small logical mistakes can break the entire solution 🧠 Biggest takeaway: Correct logic flow matters more than just writing code that compiles. Consistent practice, clearer logic, and better problem-solving—one day at a time 💪 #Day18 #LeetCode #DSA #Java #ProblemSolving #Consistency #LearningInPublic
To view or add a comment, sign in
-
Solved “3Sum Closest” (LeetCode – Medium) using the Two Pointer approach. Problem Solved: 3Sum Closest Approach: • Sorted the array to enable efficient pointer movement • Fixed one element and used left & right pointers to evaluate possible sums • Updated the closest sum based on minimum absolute difference from the target Key Learnings: • How sorting simplifies multi-pointer problems • Using absolute difference to track optimal results • Applying two-pointer logic beyond exact matches This problem helped me improve my understanding of: • Array-based problem solving • Two-pointer optimization techniques • Writing clean and readable logic Staying consistent with DSA practice to strengthen problem-solving fundamentals #DSA #TwoPointers #LeetCode #ProblemSolving #LearningByDoing #Java #CodingPractice
To view or add a comment, sign in
-
-
👇 🚀 Day 52 of #100DaysOfCode 💻 Consistency check: still going strong 💪 Today’s problem was a clean and practical string manipulation question — 📝 Length of Last Word (LeetCode) 📌 Problem Summary Given a string consisting of words and spaces, find the length of the last word in the string. Example: "Hello World" → 5 Sounds simple, but edge cases matter: Trailing spaces Multiple spaces between words 🧠 My Approach Instead of splitting the string (which uses extra space), I traversed the string from the end: 1️⃣ Skip all trailing spaces 2️⃣ Count characters until a space is found This keeps the solution efficient and clean. ⚙️ Complexity Analysis ⏱ Time: O(n) 💾 Space: O(1) Optimized and interview-friendly 🚀 🔥 Key Learning Not every problem needs complex logic Backward traversal is a powerful trick for string problems Handling edge cases is what makes solutions robust ✅ Accepted with 0 ms runtime Another step forward in my coding journey ✔️ On to Day 53! 🚀💻 #100DaysOfCode #LeetCode #Java #Strings #ProblemSolving #DSA #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Day 57 of #100DaysOfCode Today’s problem was a clean and classic two-pointer exercise — 🔁 LeetCode 344: Reverse String Simple on the surface, but a great reminder of in-place algorithms and pointer manipulation. 📌 Problem Summary You’re given a character array s. Your task is to reverse the array in-place, using O(1) extra space. 🧠 Approach Used: Two Pointers ✔️ Initialize: left = 0 right = s.length - 1 ✔️ Swap characters while left < right, then move pointers inward. This ensures: No extra memory Linear traversal Clean and readable logic ⚙️ Complexity Analysis ⏱ Time Complexity: O(n) 💾 Space Complexity: O(1) (in-place) ✔️ 477 / 477 test cases passed 🚀 Runtime: 0 ms (Beats 100%) 🔥 Key Learning Even the simplest problems reinforce core fundamentals: Two-pointer technique In-place operations Space optimization Mastering basics = dominating harder problems later 💪 Onward to Day 58 🚀 #100DaysOfCode #LeetCode #ReverseString #TwoPointers #Java #DSA #ProblemSolving #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🔹 Day 85 – #100DaysOfLeetCode Problem: 3010. Divide an Array Into Subarrays With Minimum Cost I Difficulty: Easy Key Insight: The cost of a subarray depends only on its first element. Since the first subarray always starts at index 0, the problem reduces to selecting the two smallest possible starting elements from the remaining array. Approach: Fix the first subarray cost as nums[0] Find the smallest and second smallest values in nums[1…n-1] Add them to get the minimum total cost Time Complexity: O(n) Space Complexity: O(1) #LeetCode #Java #ProblemSolving #CodingChallenge #100DaysOfCode #DSA #LearningEveryday
To view or add a comment, sign in
-
-
LeetCode Practice - 1071. Greatest Common Divisor of Strings 💡 Logic ✔If a string x divides both str1 and str2, then: 📌str1 + str2 must equal str2 + str1 📌Length of x = gcd(str1.length, str2.length) 📌x = prefix of str1 of that length We use GCD because the length of the common string must divide both string lengths exactly. 🔹 What does the problem want? We need the largest string x such that: str1 = x + x + x + ... str2 = x + x + x + ... So: ✔x must repeat exactly to form both strings ✔No extra characters allowed #LeetCode #Java #StringHandling #CodingPractice #ProblemSolving #DSA #DeveloperJourney #TechLearning
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