Most people understand cycle detection… but get stuck when asked to find where the cycle starts. 🚀 Day 19/100 — LeetCode Challenge Solved Linked List Cycle II 💡 Step 1: Detect cycle -Use slow & fast pointers -If they meet → cycle exists 💡 Step 2: Find starting node -Move fast back to head -Move both one step at a time -Where they meet again → start of cycle 👉 This part is pure intuition + math 🧠 Time Complexity: O(n) 💾 Space Complexity: O(1) 💡 What I learned: Detecting a cycle is easy. Finding its starting point is where real understanding begins. This is one of those problems where you either memorize… or truly understand. Have you ever understood why this works? #LeetCode #DSA #100DaysOfCode #Cpp #LinkedList #TwoPointers #CodingJourney
Detecting Linked List Cycle and Finding Its Start
More Relevant Posts
-
Day 4/100 of my LeetCode Journey Back on track after a short break, and today’s problem was “Kth Smallest Element in a Sorted Matrix.” At first, I didn’t approach it correctly. I was thinking in terms of simple indexing, but this problem required a different perspective. I learned how a min heap can be used to efficiently track the smallest elements across multiple rows. Instead of checking the entire matrix, the idea is to always pick the smallest available element and move forward from there. What I noticed today is that my logic is improving, but I still need to be careful with implementation. Small syntax and indexing mistakes can break the whole solution even when the approach is right. Takeaway: Understanding the approach is important, but writing clean and correct code is equally important. Making steady progress, one problem at a time. Question: Do you also find implementation harder than understanding the logic? #Day4 #LeetCode #DSA #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
100 LeetCode problems solved ! and honestly, it's taught me more about thinking than coding. When I started, I used to jump straight to the solution. Now I've learned to slow down — understand the problem, think brute force first, then optimize. Patterns I've been focusing on: → Sliding Window → Two Pointers → Stack & Queue → Kadane's Algorithm → Prefix Sum → Merge Intervals → Linked List The biggest shift wasn't in the number of problems solved — it was learning to recognize WHY a particular approach works, not just HOW. Still a long way to go. But consistency is starting to show results. 100 done. More to come. 🎯 #DSA #LeetCode #CodingJourney #SoftwareEngineering #100Problems
To view or add a comment, sign in
-
-
Day 11: LeetCode 344 – Reverse String Sometimes the simplest problems are the ones that sharpen your fundamentals the most. Today’s problem focused on reversing a character array in-place, and the cleanest way to approach it was using the two-pointer technique. 🔹 Key Idea: Instead of creating a new array, use two pointers: One at the beginning One at the end Swap them and move inward until they meet. This approach avoids extra space and keeps the solution efficient. 🔹 What I learned: Not every problem needs complex logic In-place operations are important for optimization Two pointers are extremely powerful for array/string problems 🔹 Complexity: Time → O(n) Space → O(1) Small problem, but a strong reminder: mastering basics is what builds consistency in DSA. Day 11 Completed. #Day11 #LeetCode #DSA #Cpp #CodingJourney #TwoPointers
To view or add a comment, sign in
-
-
Just crossed 100 problems solved on LeetCode. Not impressive by itself—but what matters is consistency. Most of these came from sticking to fundamentals like arrays, two pointers, and basic problem patterns instead of jumping around randomly. Current focus: • Strengthening problem-solving patterns • Reducing time per problem • Moving from Easy → Medium consistently Still a long way to go. Next target: 200 with stronger Medium coverage. If you're grinding LeetCode too, focus less on quantity and more on pattern recognition—it compounds faster. #LeetCode #DSA #CodingJourney #ProblemSolving #SoftwareEngineering
To view or add a comment, sign in
-
-
🧠 Day 32/75: Solving for the "End" from the "Beginning" Linked Lists can be tricky because you can't access elements by index. So, how do you remove the Nth element from the back without knowing the total length? Today’s LeetCode session was a deep dive into Pointer Logic. By maintaining a specific distance between two pointers, I was able to identify and delete the target node in a single traversal. Current Progress: 📅 32 Days Consecutive 🎯 Focus: Advanced Linked List Patterns ⚡ Result: 100% Beats Runtime Another day, another problem solved. The second month is off to a strong start! 💻🔥 #Consistency #100DaysOfCode #DSA #CodingJourney #JavaDeveloper #TechGrowth #LeetCodeChallenge #LinkedInLearning
To view or add a comment, sign in
-
-
🧠 Cracking LeetCode Became Easier Once I Understood Patterns Earlier, I used to approach every problem from scratch — which was slow and frustrating. Then I realized most problems follow common patterns: 🔁 Sliding Window – for subarrays/substrings 🐢🐇 Two Pointers – for sorted arrays & linked lists 🧩 Hashing – for fast lookups 🔍 Binary Search – for efficient searching 🔄 Backtracking – for combinations & recursion 💡 Key Insight: You don’t need to memorize solutions — just recognize the pattern. Once I started focusing on patterns, problem-solving became faster and more structured. Currently practicing consistently and improving my approach 🚀 #LeetCode #DSA #CodingInterview #SDET #ProblemSolving
To view or add a comment, sign in
-
🚀 Day 51 of my LeetCode Journey Solved: Roman to Integer At first glance, this problem looks simple — just map symbols to numbers. But the real catch is handling subtractive cases like IV (4), IX (9), etc. 💡 Key Learning: Instead of blindly adding values, you need to compare current and next characters: If current < next → subtract Else → add This small twist is what separates a correct solution from a wrong one. 📊 Result: ✅ Accepted ⏱️ Runtime: 6 ms 📌 Takeaway: Even “easy” problems test your attention to detail. Don’t underestimate them. Consistency > Motivation. See you on Day 52. #LeetCode #DSA #CodingJourney #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
Day 29 – LeetCode Journey 🚀 Solved Two Sum II – Input Array Is Sorted using the Two Pointer technique, leveraging the sorted nature of the array for an optimal solution. 🔹 Time Complexity: O(n) 🔹 Runtime: 2 ms (Beats 96.37%) 🔹 Memory Usage: 48.58 MB This problem is a great reminder that recognizing patterns (like sorted arrays) can significantly reduce complexity and improve efficiency. Small optimizations, big impact 📈 Staying consistent and sharpening problem-solving skills every day. #LeetCode #DSA #ProblemSolving #CodingJourney #SoftwareEngineering #Consistency #Learning
To view or add a comment, sign in
-
-
🚀 Day 76 of #100DaysOfCode Today, I solved LeetCode 18 – 4Sum, a classic problem that extends the two-pointer technique to higher complexity. 💡 Problem Overview: Given an array, the task is to find all unique quadruplets that sum up to a target value. 🧠 Approach: ✔️ Sorted the array to simplify processing ✔️ Fixed two elements using nested loops ✔️ Applied the two-pointer technique for the remaining two elements ✔️ Carefully handled duplicates to ensure unique quadruplets This approach efficiently reduces unnecessary computations compared to brute force. ⚡ Key Takeaways: Sorting + Two Pointers is a powerful combination Avoiding duplicates is crucial in combination problems Breaking a complex problem into smaller parts simplifies logic 📊 Complexity Analysis: Time Complexity: O(n³) Space Complexity: O(1) (excluding output) Consistently pushing boundaries and solving more complex problems 🚀 #LeetCode #100DaysOfCode #DSA #TwoPointers #ProblemSolving #CodingJourney #SoftwareDevelopment #InterviewPrep
To view or add a comment, sign in
-
-
🚀 Day 17/100 — LeetCode Challenge Solved Reverse Linked List At first, it feels tricky because we need to change the direction of links without losing the list. 💡 Approach (Iterative): 1) Use three pointers: prev, curr, next 2) Store the next node 3) Reverse the link (curr → prev) 4) Move all pointers forward 👉 Repeat until the list is fully reversed 💡 Key Insight: We’re not just moving through the list, we’re rebuilding it in reverse order. 🧠 Time Complexity: O(n) 💾 Space Complexity: O(1) 💡 What I learned: Linked List problems are less about logic, and more about careful pointer handling. One small mistake = broken list. #LeetCode #DSA #100DaysOfCode #Cpp #LinkedList #CodingJourney
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