🚀 Day 5/100 – #100DaysOfDSA Today’s focus was on recursion and understanding how problems break down into smaller subproblems. 🔹 Problems Solved: 1. Power of Two 2. Fibonacci Number 💡 Key Learnings: 👉 Problem 1: Power of Two (Using Recursion) Base Case: n === 1 → true If n is divisible by 2, recursively check n / 2 If not divisible → false ✅ Clean recursive breakdown ✅ Helps understand divide-by-2 pattern 👉 Problem 2: Fibonacci Number (Using Recursion) Base Cases: F(0) = 0, F(1) = 1 Recursive Relation: F(n) = F(n-1) + F(n-2) ✅ Learned that: Simple recursion is intuitive 🔥 What I learned today: Recursion is powerful for understanding problem structure. Building consistency, one step at a time 💪 #100DaysOfCode #DSA #Recursion #LeetCode #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic
Recursion in Problem Solving with Power of Two and Fibonacci Number
More Relevant Posts
-
🚀 Day 23 of #60DaysOfDSA Today I implemented Quick Sort, a powerful Divide & Conquer algorithm used for sorting. 🔍 What I learned: Quick Sort works by selecting a pivot element It partitions the array into: Elements smaller than pivot Elements greater than pivot Then recursively sorts both parts ⚡ Key Insight: “Partitioning is the heart of Quick Sort.” Even a small mistake in index handling or swapping can completely break the logic. 💻 Key Concepts Covered: ✔️ Pivot selection (last element) ✔️ Partition logic (Lomuto method) ✔️ Recursion ✔️ In-place sorting 🧠 Takeaway: Quick Sort is not just about writing code, it’s about understanding how elements move and how recursion divides the problem. Consistency > Perfection 🚀 One step closer to becoming better every day! #DSA #QuickSort #CodingJourney #JavaScript #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 13/100 – #100DaysOfDSA Today was all about efficient deletion in Linked Lists and handling edge cases in a single pass 🔗 🔹 Problems Solved: 1. Remove Nth Node From End of List 2. Remove Duplicates from Sorted List 💡 Key Learnings: 👉 Problem 1: Remove Nth Node From End Used Two Pointer Technique (Fast & Slow) Move fast pointer n steps ahead Then move both pointers until fast reaches the end Slow will be just before the node to delete 👉 Key Trick: Use a dummy node to handle edge cases (like removing head) ✅ One-pass solution ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Remove Duplicates from Sorted List Since list is sorted → duplicates are adjacent Traverse and compare current node with next Skip duplicate nodes ✅ O(n) Time ✅ O(1) Space 🔥 What I learned today: Using dummy nodes + two pointers makes Linked List problems much cleaner and avoids edge-case bugs. Patterns are repeating, confidence is growing 📈 Day 13 done ✅ Let’s keep pushing 💪 #100DaysOfCode #DSA #LinkedList #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic #Developers
To view or add a comment, sign in
-
🚀 Day 2/100 – #100DaysOfDSA Continuing the journey with two interesting problems today! 🔹 Problems Solved: Best Time to Buy and Sell Stock Reverse String 💡 Key Learnings: 👉 Problem 1: Best Time to Buy & Sell Stock Used a greedy + two pointer mindset Track the minimum price so far (buy) and calculate profit at each step Update max profit whenever a better opportunity appears ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Reverse String Classic Two Pointer Technique One pointer at start, one at end Swap characters and move inward ✅ In-place solution ✅ No extra memory used 🔥 What I learned today: Sometimes the best solutions are not complex — just about tracking the right values at the right time. Consistency > Perfection. See you on Day 3 💪 #100DaysOfCode #DSA #LeetCode #ProblemSolving #CodingJourney #JavaScript #Developers #TechGrowth #SoftwareEngineer #LearningInPublic
To view or add a comment, sign in
-
🚀 Day 21 of #DevDSA 🔹 Problem: Merge Two Sorted Arrays (Using Extra Space) Today I worked on merging two sorted arrays into a single sorted array using an additional array. 🧠 Approach: Used two pointers (l for nums1 and r for nums2) Compared elements one by one Pushed the smaller element into a new mergedArray Handled equal elements by pushing both Continued until one array is exhausted 💡 Key Idea: Since both arrays are already sorted, we can efficiently merge them in linear time without sorting again. ⏱ Time Complexity: O(m + n) 📦 Space Complexity: O(m + n) 📌 What I learned: Two-pointer technique is very powerful for sorted data Writing clean conditions avoids unnecessary complexity Always think about edge cases (like remaining elements after loop) 💻 Next Step: Try solving the same problem without extra space (in-place optimization 🔥) #DSA #100DaysOfCode #CodingJourney #JavaScript #InterviewPrep
To view or add a comment, sign in
-
-
🚀 Day 12 of My LeetCode Journey — Linked List Patterns Getting Stronger Today’s problems: 🔹 Intersection of Two Linked Lists (LeetCode 160) 🔹 Remove Linked List Elements (LeetCode 203) 💡 Problem 1: Intersection of Two Linked Lists Explored two approaches: ✅ Brute Force Traverse headA and check every node in headB ⏱️ Time: O(m × n) ✅ Using Set Store all nodes of headB in a Set Traverse headA and check for intersection ⏱️ Time: O(m + n) | 📦 Space: O(n) 👉 Helped me understand how hashing can optimize comparisons. 💡 Problem 2: Remove Linked List Elements Solved using a Sentinel (Dummy) Node 🔥 👉 Create a dummy node before head 👉 Use prev pointer to skip unwanted nodes: prev.next = prev.next.next This approach simplifies edge cases like: Removing head node Multiple consecutive deletions 🧠 What I Learned: Sentinel nodes make linked list problems cleaner Hashing can reduce time complexity significantly Thinking in terms of nodes (not values) is key 🔥 Key Takeaways: Always look for ways to reduce nested loops Dummy nodes = lifesaver in linked list problems Practice is making pointer manipulation more intuitive Grateful for the guidance from Namaste DSA and Akshay Saini 🚀 Day 13 loading… 💪 #LeetCode #DataStructures #Algorithms #CodingJourney #100DaysOfCode #SoftwareEngineering #Programming #InterviewPrep #JavaScript #CodingLife #TechGrowth #ProblemSolving #Developers #LearnToCode #LinkedList #DSA #NamasteDSA #AkshaySaini
To view or add a comment, sign in
-
Day 112 of #200DaysOfCode Leveling up Consistency continues, one concept at a time. Today I solved the "Memoize" problem on LeetCode using closures + caching in JavaScript. Key Idea: Avoid recomputing the same function call by storing previously calculated results. Approach: • Use a Map as cache storage • Convert arguments into a unique key using JSON.stringify() • If result already exists return cached value • Otherwise compute, store, and return result Concepts Used: • Closures • Memoization • Map • Higher Order Functions Time Complexity: • First Call → Depends on function • Repeated Calls → O(1) average lookup Space Complexity: O(n) Takeaway: Memoization is a powerful optimization technique that trades space for speed and is heavily used in Dynamic Programming and performance optimization. Learning not just to solve problems — but to make solutions smarter Let’s keep building #Day112 #200DaysOfCode #LeetCode #JavaScript #Memoization #Closures #CodingJourney #ProblemSolving #KeepGoing
To view or add a comment, sign in
-
-
🚀 Day 6/100 – #100DaysOfDSA Today’s focus was on searching vs sorting and understanding efficiency differences. 🔹 Problems Solved: 1. Binary Search 2. Bubble Sort 💡 Key Learnings: 👉 Problem 1: Binary Search Works only on sorted arrays Divide the search space into half each time 👉 Approach: Find mid index Compare with target Move left or right accordingly ✅ O(log n) Time Complexity ✅ Very efficient for large datasets 👉 Problem 2: Bubble Sort Most people implement Bubble Sort, but today I learned how to optimize it using an early break condition 🚀 👉 Approach: If no swaps happen in a pass, the array is already sorted — so we can stop early instead of continuing unnecessary iterations. ✅O(n) (Optimized with swap flag) 🔥 What I learned today: Choosing the right algorithm matters more than just solving the problem. Consistency continues 💪 Day 6 done! #100DaysOfCode #DSA #BinarySearch #Sorting #LeetCode #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic
To view or add a comment, sign in
-
🚀 DSA Learning (Realization while solving Top K Frequent Elements) My initial approach was simple: 👉 Count frequency of each number using a HashMap 👉 Then compare frequency with k and push elements into a result array But then I got stuck… ❓ I tried to use .map() directly on the HashMap — and it didn’t work That’s when I realized: - Map is not an array, so array methods like .map() won’t work on it - What actually works: First convert the map into an array 👇 Array.from(map.entries()) Then: ✔️ sort by frequency ✔️ take top k ✔️ extract elements That small shift in understanding made the whole problem click 💡 #DSA #JavaScript #CodingJourney #LeetCode
To view or add a comment, sign in
-
-
🚀 Just Uploaded a New LeetCode Solution! Solved LeetCode #26 – Remove Duplicates from Sorted Array using the Two Pointer Technique in JavaScript. This is a must-know pattern for coding interviews — simple idea, but very powerful when applied correctly. 👉 In this video, I’ve covered: Intuition behind the problem Step-by-step dry run Optimal in-place solution (O(n) time, O(1) space) Clean and easy-to-understand JavaScript code 🔗 Watch here: https://lnkd.in/g-HgkGXQ If you're preparing for coding interviews or strengthening your DSA fundamentals, this one is definitely worth your time. Would love to hear your approach to this problem — drop it in the comments 👇 #leetcode #dsa #codinginterview #javascript #twopointer #programming #softwaredevelopment #coding #developers #learning #jdcodebase
Remove Duplicates from Sorted Array | Optimal Two Pointer Approach 🔥 | LeetCode Explained (JS)
https://www.youtube.com/
To view or add a comment, sign in
-
🚀 Day 12/100 – #100DaysOfDSA Today was all about handling edge cases and smart traversal in Linked Lists 🔗 🔹 Problems Solved: 1. Intersection of Two Linked Lists 2. Remove Linked List Elements 💡 Key Learnings: 👉 Problem 1: Intersection of Two Linked Lists Used a HashSet approach Store nodes of one list and check in the other ✅ O(n + m) Time ❌ O(n) Space 💡 Optimization Insight: Can be solved using Two Pointer Technique with O(1) space Traverse both lists → switch heads → they meet at intersection 👉 Problem 2: Remove Linked List Elements Traverse the list and remove nodes matching given value Use a dummy node to handle edge cases (like removing head) 👉 Key Idea: Always keep track of previous node while deleting ✅ O(n) Time ✅ O(1) Space 🔥 What I learned today: Handling edge cases (like deleting head nodes or null cases) is just as important as solving the problem itself. Also learned that there’s always a more optimal solution worth exploring 👀 Day 12 done ✅ Let’s keep going strong 💪 #100DaysOfCode #DSA #LinkedList #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic #Developers
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