Day 16 | LeetCode Learning Journal 🚀 Today I tackled Problem 344: Reverse String. While it's a fundamental problem, it’s the perfect playground for mastering the Two-Pointer technique. It’s fascinating how shifting from a "create a new copy" mindset to an in-place manipulation approach can drastically optimize space complexity. Efficiency isn't just about speed; it's about being smart with the resources you have. Key Takeaways: In-place algorithms: Swapping elements directly within the array to achieve O(1) extra space. Efficiency: Seeing that "Accepted" screen with optimized memory usage is always a win. Refinement: Even simple problems offer a chance to write cleaner, more idiomatic C++ code. #LeetCode #100DaysOfCode #CodingJourney #ProblemSolving #CPlusPlus #DSA #LearningInPublic #KeepGrowing #TwoPointers
Mastering Two-Pointer Technique with LeetCode's Reverse String Problem
More Relevant Posts
-
Day 18 | LeetCode Learning Journal 🚀 Today I tackled Problem 403: Frog Jump, and this one really pushed me to think beyond simple linear logic. Moving from the string manipulation of yesterday to a Hard-level Dynamic Programming problem was a significant leap. It’s fascinating how a problem that seems like a simple pathfinding task actually requires deep insights into state management. I learned that sometimes you don't just need to know where you are, but also the "momentum" (the jump size) that got you there. Key takeaways from today: State Representation: Realized the necessity of a 2D state or a map of sets to track both the stone position and the last jump distance. Memoization is King: Saw firsthand how storing computed paths prevents the exponential time complexity that would otherwise crash the solution. Resilience: Hard problems can be intimidating, but breaking them down into small, logical sub-problems makes them manageable. #LeetCode #100DaysOfCode #CodingJourney #ProblemSolving #CPlusPlus #DSA #LearningInPublic #DynamicProgramming #KeepGrowing
To view or add a comment, sign in
-
-
🚀 LeetCode Journey – Post #2 https://lnkd.in/gMaJrTkJ Today I solved LeetCode Problem #69 – Sqrt(x) using Binary Search. 🔹 Problem Statement: Given a non-negative integer x, return the square root of x rounded down to the nearest integer. 🔹 Approach: Instead of using built-in functions, I implemented Binary Search to find the square root efficiently. • Start the search range from 0 to x • Calculate mid and check mid * mid • If it equals x, return mid • If mid * mid < x, move to the right half • If mid * mid > x, move to the left half • Store the closest possible answer during the search ⏱ Time Complexity: O(log n) 💡 Key Learning: Binary Search can be applied not only on sorted arrays but also on mathematical problems like square roots. I’m continuing my DSA + LeetCode practice and sharing my progress here. #leetcode #dsa #binarysearch #cpp #codingpractice #learninginpublic
To view or add a comment, sign in
-
-
Day 28 | LeetCode Learning Journal 🚀 Today I tackled Problem 37: Sudoku Solver, and this one was a true test of patience and algorithmic thinking. Moving from simple patterns to complex backtracking has been a game-changer. It’s fascinating how recursion allows us to explore thousands of possibilities, "pruning" the ones that don't work and pivoting until we find the perfect solution. It’s not just about writing code; it’s about teaching the program how to make decisions. Key takeaways from today: Backtracking Mastery: Understanding how to "undo" a choice is as important as making one. Validation Logic: Breaking down constraints (rows, columns, and 3x3 grids) into clean, reusable functions. #LeetCode #100DaysOfCode #CodingJourney #ProblemSolving #CPlusPlus #DSA #Backtracking #LearningInPublic #KeepGrowing
To view or add a comment, sign in
-
-
Day 25 | LeetCode Learning Journal 🚀 Today I tackled the classic N-Queens problem. If Day 12 was about patterns and counting, today was all about Backtracking and visualizing the recursion tree. Key Takeaways: Backtracking is Art: It’s not just about trying every possibility; it’s about "pruning" the branches that don't work early on to save time. The isSafe Logic: Writing a clean helper function to check rows, columns, and diagonals is the heart of this problem. It really tests your ability to think spatially in a grid. Debugging Recursion: Seeing that "Accepted" green text for a Hard/Medium-Hard backtracking problem hits different. It’s a sign that my ability to trace complex code is sharpening. "Consistency matters more than perfection." 25 days down—a quarter of the way through the 100-day mark! The problems are getting tougher, but the logic is becoming more intuitive. Excited to keep pushing deeper into advanced algorithms. #LeetCode #100DaysOfCode #CodingJourney #ProblemSolving #CPlusPlus #DSA #Backtracking #NQueens #LearningInPublic #KeepGrowing
To view or add a comment, sign in
-
-
🚀 LeetCode Daily Challenge – Binary Gap 📌 Problem: Binary Gap 🔗 LeetCode - Daily Question Today’s problem focused on analyzing binary representation using bit manipulation. The goal: Find the maximum distance between two consecutive set bits (1s) in a number’s binary form. Brute force string conversion? Possible—but unnecessary. ❌ Bitwise traversal? Clean and optimal. ✅ 💡 Key Insight: - Traverse bits from LSB to MSB - Track the position of the last seen "1" - For every new "1", compute distance from previous - Maintain the maximum gap 🛠 Approach: • Iterate while "n > 0" • Check "(n & 1)" for set bit • Track positions using a counter • Update max distance • Right shift "n" ⏱ Complexity: Time: O(log n) Space: O(1) ✔ Accepted ✔ Clean bit manipulation logic ✔ Reinforced fundamentals of binary traversal Takeaway: Sometimes the simplest bit tricks outperform heavier approaches—clarity wins. Practicing DSA daily with LeetCode, learning alongside CoderArmy, and guided by Rohit Negi, Aditya Tandon Day 26 done. Staying consistent. 🚀 #Day26/90 #LeetCode #DSA #BitManipulation #ProblemSolving #CPlusPlus #LearningInPublic #ProblemSolving2026
To view or add a comment, sign in
-
-
Day 24 | LeetCode Learning Journal 🚀 Today was all about tackling Problem 47: Permutations II, and it was a masterclass in the art of Backtracking. While the first permutations problem is about exploring possibilities, this one adds a layer of complexity: handling duplicates. It’s fascinating how a small constraint—like ensuring each permutation is unique—completely changes the strategy. It forced me to think deeply about state management and how to use sorting and conditional checks to "prune" the search tree, preventing redundant calculations. Key Takeaways from Today: Pruning is Power: Learning when not to explore a path is just as important as knowing how to traverse one. The Power of Recursion: Breaking down a complex combinatorial problem into smaller, repeatable logic steps is where the magic happens. #LeetCode #100DaysOfCode #CodingJourney #ProblemSolving #CPlusPlus #DSA #Backtracking #LearningInPublic #KeepGrowing
To view or add a comment, sign in
-
-
Day 20 | LeetCode Learning Journal 🚀 Today was all about Problem 63: Unique Paths II. Moving from simple pathfinding to navigating a grid filled with obstacles really highlights the beauty of Dynamic Programming. It’s about turning a complex, branching tree of possibilities into a clean, efficient, iterative solution. What I learned today: Handling Constraints: Adding obstacles isn't just a minor tweak; it changes how you initialize your DP table and handle edge cases. Optimal Substructure: The number of ways to reach grid[i][j] is simply the sum of ways from the top and the left—provided the path isn't blocked. Efficiency Matters: Seeing that 0ms runtime (Beats 100%) is the ultimate "aha!" moment. It proves that clean logic and space optimization (like using a 1D DP array) pay off. 20 days in, and the logic is starting to feel like second nature. The problems are getting tougher, but the clarity is getting sharper. Consistency truly is the bridge between confusion and mastery. Onward to Day 21! 🧱🏃♂️ #LeetCode #100DaysOfCode #CodingJourney #DynamicProgramming #CPlusPlus #DSA #LearningInPublic #Consistency #SoftwareEngineerin
To view or add a comment, sign in
-
-
🚀 900 LeetCode Questions Solved 🚀 Today I hit a milestone I once thought was impossible — 900 problems on LeetCode. This journey wasn’t about streaks or badges. It was about: Building disciplined problem-solving habits Strengthening data structures & algorithms fundamentals Learning to stay consistent even on low-motivation days Turning frustration into growth From struggling with basic recursion to confidently tackling dynamic programming and graph problems — every question added a layer of clarity. The biggest lesson? 👉 Consistency compounds. 👉 Small daily improvements beat occasional bursts of effort. Now aiming for 1000 — but more importantly, aiming to become a better thinker and engineer every single day. If you're on the DSA grind, keep going. The breakthrough is closer than you think. 💪 #LeetCode #DSA #CodingJourney #SoftwareEngineering #ProblemSolving #Consistency #TechGrowth #600DaysOfCode #Developers #python #Programming
To view or add a comment, sign in
-
-
Day 17 | LeetCode Learning Journal 🚀 Today’s focus: Problem 125: Valid Palindrome. Moving from frequency counting (Day 12) to the Two-Pointer technique has been a game-changer. It’s fascinating how shifting from "how many characters do I have?" to "where are my pointers meeting?" optimizes both space and time complexity. The real challenge today wasn't just the logic, but handling the "noise"—filtering out non-alphanumeric characters and managing case sensitivity. It's a great reminder that real-world data is rarely clean, and our code needs to be resilient. 17 days in. The problems are getting more nuanced, but the process is becoming second nature. #LeetCode #100DaysOfCode #CodingJourney #ProblemSolving #CPlusPlus #DSA #LearningInPublic #KeepGrowing
To view or add a comment, sign in
-
-
🚀 Day 15 | 100 Days of Coding Challenge #DrGViswanathanChallenge 📘 Problem Solved: Generate Parentheses (LeetCode) 🔧 Approach Used (Backtracking): • Generated all possible combinations of parentheses • Validated each string using balance checking • Collected only well-formed sequences ⏳ Complexity: Time: O(2ⁿ) (generation + validation) Space: O(n) (recursion stack) 🧠 Key Learning: Backtracking helps explore all combinations, but adding constraints early can greatly improve efficiency. 📂 Topics Covered: Backtracking, Recursion, Strings #100DaysOfCode #DSA #CPP #LeetCode #CodingJourney #CompetitiveProgramming
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