🧠 Day 25 Theme: Recursion & Backtracking Concepts Covered Recursive calls and base conditions Decision tree and state-space exploration Backtracking for constraint satisfaction Handling duplicates and pruning branches Classic examples: combinations, permutations, subsets, and N-Queens 📚 Learn from These Resources 📘 Recursion Fundamentals 👉 https://lnkd.in/gPQvuduf 👉 https://lnkd.in/gt-mteqM 📗 Backtracking Algorithms 👉 https://lnkd.in/gaRCKvJT 👉 https://lnkd.in/g87eEpKa 📙 Visual Demos & Tutorials 👉 https://lnkd.in/g8FWB-Mq 👉 https://lnkd.in/g6Rt5zgf 🧩 Practice Ideas Generate all subsets of an array Solve permutations of numbers or strings N-Queens / Sudoku solver (classic backtracking) Word search (DFS + backtracking combo) Combinations that sum to target (like Combination Sum I/II) #75DaysOfKnowledge #Recursion #Backtracking #ProblemSolving #CodingJourney #LeetCode #AlgorithmicThinking #Java #Python #Programming
"Learn Recursion & Backtracking with Examples and Resources"
More Relevant Posts
-
🚀 Day 44 of #100DaysOfDSA — Longest Substring Without Repeating Characters Problem: Given a string s, find the length of the longest substring without repeating characters. Concepts Used: 🧠 Sliding Window Technique 📊 Hash Map for tracking character indices Approach Summary: We maintain two pointers (l and r) to represent the current window and a map to store the last index of each character. Whenever a repeating character appears, we move l to the right of the previous occurrence. At each step, we calculate the window size and keep track of the maximum. Code Insight: This method ensures we traverse each character only once, resulting in an O(n) time complexity and O(256) space (for ASCII). Learning Reflection: Initially, I struggled to understand why we need to use max(mp[ord(s[r])] + 1, l) while updating l. But after debugging, I realized it ensures we never move l backward, keeping the window valid. Output: ✅ Accepted with 0ms runtime on LeetCode! Motivational Note: “Consistency beats talent — one solved problem at a time.” 💪 #LeetCode #DSA #100DaysOfCode #Python #CodingJourney #SlidingWindow #ProblemSolving #AnkitLearns
To view or add a comment, sign in
-
-
💯 Day 40 / 100 – 100 Days of #LeetCode Challenge 🔁 Problem: 674. Longest Continuous Increasing Subsequence Goal: Given an unsorted array of integers nums, find the length of the longest continuous increasing subsequence (subarray) — the numbers must be strictly increasing and appear consecutively. Approach: ✅ Initialize two variables — currLen for the current increasing streak and long for the longest found so far. ✅ Traverse the array and compare each element with the previous one. ✅ If current > previous, increase currLen and update long. ✅ Otherwise, reset currLen to 1. ✅ Return long as the final answer. Complexity: ⏱ Time: O(n) – Single pass through the array. 🗂 Space: O(1) – Constant extra space. 💡 Key Takeaways: A simple iteration can efficiently handle continuous subarray problems. Keeping track of streaks is a common pattern in array-based challenges. Great for practicing iteration, condition handling, and edge cases. #100DaysOfLeetCode #Day40 #Python #DSA #CodingChallenge #ProblemSolving #LeetCode #LearningEveryday
To view or add a comment, sign in
-
-
💡 Merge Sorted Array — LeetCode #88 Today I practiced one of the most common array problems — Merge Sorted Array, a great example of the two-pointer technique and in-place manipulation. Problem: You’re given two sorted arrays: nums1 with extra space at the end nums2 with n elements The goal is to merge them into a single sorted array inside nums1, without using extra space. Key Idea (Pattern): ➡️ Instead of merging from the front, we start from the back. This avoids overwriting elements in nums1 and lets us fill it from the largest to smallest. Approach: Use three pointers: p1 → end of valid elements in nums1 p2 → end of nums2 p → last index of nums1 Compare elements from both arrays and insert the larger one at the end of nums1. Copy any remaining elements from nums2. Time Complexity: O(m + n) Space Complexity: O(1) Pattern Learned: Two Pointers (backward traversal for in-place merging) Related Problems: Move Zeroes, Sort Colors, Merge Intervals Every time I solve one of these classic problems, I realize how much coding interviews are about recognizing patterns — not memorizing solutions. 💭 #LeetCode #DSA #CodingInterview #Python #Arrays #TwoPointers #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 82 of #100DaysOfDSA 🚀 Solved LeetCode 8 — String to Integer (atoi) 🔹 Problem: Implement the atoi function which converts a string to a 32-bit signed integer, handling whitespace, optional signs, and overflow conditions. 🔹 Approach: Used String Manipulation + Edge Case Handling 1️⃣ Trim leading and trailing whitespaces using strip(). 2️⃣ Check for optional '+' or '-' sign and store it. 3️⃣ Iterate through the string, building the integer digit by digit until a non-digit character appears. 4️⃣ Clamp the result to fit within 32-bit integer bounds [-2³¹, 2³¹−1]. ✨ Key Insight: Careful handling of edge cases and boundaries is crucial in string-to-integer problems — it’s all about precision and attention to detail. #LeetCode #DSA #Python #ProblemSolving #StringManipulation #CodingJourney #100DaysOfCode 🚀
To view or add a comment, sign in
-
-
🧠 Day 44 / 100 – Product of Array Except Self (LeetCode #238) Today’s challenge was all about computing an array where each element is the product of all numbers except itself — without using division. This one teaches prefix and suffix logic beautifully. The trick is to build two running products: One from the left (prefix) One from the right (suffix) Then combine both to get the final result. No division needed, no nested loops — just clean, efficient logic. 🔍 Key Learnings Use prefix and suffix multiplications for O(n) time complexity. Avoid division to handle zero cases efficiently. Think about how to reuse partial results rather than recomputing them. 💭 Thought of the Day Efficiency comes from rethinking the obvious. Instead of brute-forcing every combination, using prefix and suffix logic shows how planning ahead can simplify everything. Each day, I’m learning to design solutions, not just write them. 🔗 Problem Link: https://lnkd.in/gbGfa4dd #100DaysOfCode #Day44 #LeetCode #Python #Arrays #PrefixSum #ProblemSolving #Algorithms #DataStructures #EfficientCoding #CodeEveryday #LearningJourney #TechGrowth #CleanCode
To view or add a comment, sign in
-
-
🚀 Day 41 of #100DaysOfDSA Solved LeetCode Problem #70 – Climbing Stairs 🪜✨ 📌 Problem Insight: You are climbing a staircase with n steps, and you can take either 1 step or 2 steps at a time. The task is to find the number of distinct ways to reach the top. A classic problem that beautifully introduces Dynamic Programming concepts! 💡 Key Learnings: Understood how this problem relates to the Fibonacci sequence. Practiced iterative DP optimization — using only two variables instead of an array. Learned how to recognize recurrence relations in real problems. Time complexity: O(n) Space complexity: O(1) 📌 Approach (short): Each step can be reached either from (n−1) or (n−2) → ways(n) = ways(n-1) + ways(n-2) 👉 Dynamic Programming problems show that thinking ahead pays off — one step at a time 🧠💪 #LeetCode #DSA #ProblemSolving #100DaysChallenge #Day41 #CodingJourney #Python #DynamicProgramming
To view or add a comment, sign in
-
-
✅ Day 53 – GFG 160 Days of Problem Solving Challenge 💡 Problem: Find Pair with Sum Closest to Target on GeeksforGeeks At first, I considered checking all pairs using two nested loops — but that approach would be O(n²) and inefficient for large arrays. 🧠 Optimized Approach (Two-Pointer Technique): Sort the array. Initialize two pointers — left at the start and right at the end. Calculate the pair sum and track the difference from the target. Update the closest pair whenever a smaller difference is found. Move pointers intelligently based on whether the sum is less than or greater than the target. This logic brings down the time complexity to O(n log n) due to sorting and O(n) for the two-pointer traversal. 🔥 Result: Solved 1115/1115 test cases successfully with 100% accuracy in just 0.55 sec! 🚀 The two-pointer method is not only efficient for exact sums but also powerful for problems involving closest sums — a great optimization over brute force! Onwards to Day 54! 💪 #DSA #GeeksforGeeks #ProblemSolving #Python #TwoPointer #Optimization #CodingChallenge #160DaysOfCode #Day53
To view or add a comment, sign in
-
-
"Day 3 is a massive win for efficiency! I dedicated the morning to mastering the Two-Pointer technique, a critical step in optimizing array algorithms. I successfully tackled two key problems, including the famous Remove Duplicates (#26), which confirmed the absolute necessity of O(1) auxiliary space optimization. Key Technical Insight: O(1) Space is King I compared different approaches for removing duplicates and confirmed the core DSA lesson: 1. The Slow/Fast Pointer method is the correct, efficient approach, achieving O(1) space and O(n) time by manipulating the array in-place. 2. Brute-force solutions using helper data structures violate the memory constraint and often lead to slow O(n^2) time complexity. The lesson is clear: Master the mechanism, don't just rely on the wrapper. Understanding this difference is essential for building scalable applications. All progress is documented and pushed. Now, the plan pivots to laying the foundation for my Python OOP skills and project architecture. #DSA #TwoPointers #Python #LeetCode #SoftwareEngineering #Consistency #O1Space"
To view or add a comment, sign in
-
Day 33 / 100 – Maximum Average Subarray (LeetCode #643) Today’s challenge was about finding a contiguous subarray of length k with the maximum average. At first glance, it seems simple, but the key is doing it efficiently. By using a sliding window, I avoided recalculating sums for every subarray, which makes the solution both fast and elegant. This problem reminded me that small optimizations in logic can lead to huge improvements in performance, and thinking carefully about how to structure your solution is just as important as solving the problem itself. 🔍 Key Learnings Sliding window technique updates the sum in constant time for each step. Keeping track of the maximum sum while iterating avoids unnecessary computations. Always ensure floating-point division for correct average calculations. 💭 Thought of the Day Efficiency in coding comes from thinking smart, not from brute force. Sliding window allowed me to write clean and readable solutions while handling all edge cases. Today reinforced that solving problems isn’t just about getting a correct answer — it’s about writing solutions that are elegant, efficient, and scalable. 🔗 Problem Link:https://lnkd.in/gCVb4_pu #100DaysOfCode #Day33 #LeetCode #Python #SlidingWindow #ProblemSolving #Algorithms #DataStructures #CodingChallenge #CodeEveryday #LearningJourney #TechGrowth #Efficiency #CleanCode #PythonProgramming
To view or add a comment, sign in
-
Explore related topics
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