🚀 Day 8 of My LeetCode Journey — Divide & Conquer Today’s problem: Sort an Array (LeetCode 912) 💡 Approach: Merge Sort (Recursive) Instead of using built-in sorting, I implemented a recursive solution using the Divide & Conquer technique. 👉 Break the array into halves 👉 Recursively sort each half 👉 Merge the sorted halves using a helper function Creating a separate merge function to combine two sorted arrays made the logic clean and modular. 🧠 What I Learned: Recursion becomes powerful when combined with Divide & Conquer Breaking problems into smaller pieces simplifies complex logic Writing helper functions improves code readability and reuse ⚡ Complexity: ⏱️ Time: O(n log n) 📦 Space: O(n) 🔥 This problem felt like a step up from basic sorting (Bubble/Selection). Understanding how efficient sorting actually works under the hood was a great experience. Thanks to Namaste DSA and Akshay Saini 🚀 for the guidance Day 9 loading… 💪 #LeetCode #DataStructures #Algorithms #CodingJourney #100DaysOfCode #SoftwareEngineering #Programming #InterviewPrep #JavaScript #CodingLife #TechGrowth #ProblemSolving #Developers #LearnToCode #MergeSort #Recursion #DivideAndConquer #NamasteDSA
Divide & Conquer: LeetCode 912 Sort an Array with Merge Sort
More Relevant Posts
-
🚀 Day 3 of My LeetCode Journey — Consistency > Motivation Today’s problem: Merge Sorted Array (LeetCode 88) At first glance, it looks simple — just merge two arrays, right? But the real challenge is doing it in-place without extra space 🤯 💡 Key Learning: Instead of merging from the front (which causes overwriting), the optimal approach is to: 👉 Use two pointers from the end 👉 Fill the array backwards This small shift in thinking makes a huge difference: ⏱️ Time Complexity: O(m + n) 📦 Space Complexity: O(1) 🔥 What I’m realizing: It’s not about solving problems — it’s about learning how to think differently Every problem is teaching me: How to optimize How to avoid brute force How to think like an interviewer On to Day 4 💪 #LeetCode #DataStructures #Algorithms #CodingJourney #100DaysOfCode #SoftwareEngineering #Programming #InterviewPrep #JavaScript #CodingLife #TechGrowth #ProblemSolving #Developers #LearnToCode #Consistency #CodeDaily
To view or add a comment, sign in
-
🚀 Day 10 of My LeetCode Journey — Mastering Linked Lists Today’s problems: 🔹 Middle of the Linked List (LeetCode 876) 🔹 Reverse Linked List (LeetCode 206) 💡 Problem 1: Middle of the Linked List Used the classic slow & fast pointer approach: 👉 Slow moves 1 step 👉 Fast moves 2 steps 👉 When fast reaches the end → slow is at the middle 🎯 Such a simple trick, yet super powerful! 💡 Problem 2: Reverse Linked List This one is a must-know 🔥 👉 Iteratively reverse pointers 👉 Keep track of prev, current, and next 👉 Flip links step by step Also explored how this can be done using recursion 🧠 What I Learned: Two-pointer techniques are extremely useful Pointer manipulation builds real confidence in DSA Linked Lists are all about careful handling of references 🔥 Key Takeaways: Small tricks (like slow/fast pointers) can simplify problems a lot Practicing core problems like reversing a linked list is essential for interviews Understanding the logic > memorizing code Grateful for the learning journey with Namaste DSA and Akshay Saini 🚀 🙌 Day 11 loading… 💪 #LeetCode #DataStructures #Algorithms #CodingJourney #100DaysOfCode #SoftwareEngineering #Programming #InterviewPrep #JavaScript #CodingLife #TechGrowth #ProblemSolving #Developers #LearnToCode #LinkedList #ReverseLinkedList #TwoPointers #NamasteDSA
To view or add a comment, sign in
-
🚀 Day 4 of My LeetCode Journey — Building Problem-Solving Muscle Today I worked on two problems: 🔹 Max Consecutive Ones (LeetCode 485) 🔹 Missing Number (LeetCode 268) 💡 Problem 1: Max Consecutive Ones This problem is all about pattern recognition. 👉 Traverse the array 👉 Keep counting consecutive 1s 👉 Reset when you hit 0 Simple logic, but a great reminder that not every problem needs complex data structures. 💡 Problem 2: Missing Number This one was interesting — multiple ways to solve it: ✔️ Sorting ✔️ HashSet ✔️ XOR ✔️ Sum formula (most optimal) The cleanest approach: 👉 Use the formula: n * (n + 1) / 2 👉 Subtract the actual sum 👉 Boom — missing number found ⚡ 🔥 Key Takeaways from Today: Not every problem needs brute force There’s always a more optimal way — look for patterns Understanding multiple approaches = stronger fundamentals Consistency is slowly turning confusion into clarity 💪 On to Day 5 🚀 #LeetCode #DataStructures #Algorithms #CodingJourney #100DaysOfCode #SoftwareEngineering #Programming #InterviewPrep #JavaScript #CodingLife #TechGrowth #ProblemSolving #Developers #LearnToCode #Consistency #CodeNewbie #DailyCoding
To view or add a comment, sign in
-
“I thought I understood backtracking… until I tried to optimize it.” 🔁🔥 Today’s focus: deep DSA revision + sharper problem-solving I revisited Backtracking and challenged myself with: 👉 LeetCode 46 – Permutations 💥 Result: ✔️ Accepted (26/26 test cases) ✔️ 0 ms runtime (100% beat) ✔️ Optimized recursive approach But the real win wasn’t the stats. It was understanding how to: Systematically explore all possibilities Prune unnecessary paths Think in terms of decision trees, not loops Key Insight: Backtracking trains you to think like a problem solver, not just a coder. And that’s where real growth happens. 💡 Tech Stack & Concepts: JavaScript • Recursion • Backtracking • DSA Patterns Grateful to AlmaBetter for structured learning and consistent support. 🙌 🚀 Focused on writing efficient, scalable logic and improving problem-solving depth. #DSA #Backtracking #LeetCode #JavaScript #ProblemSolving #SoftwareEngineer #CodingJourney
To view or add a comment, sign in
-
-
Been spending some time revisiting fundamentals lately — and honestly, nothing beats clean, simple code. In a world full of frameworks and shortcuts, it’s easy to forget that strong basics still do most of the heavy lifting. A few small snippets I’ve been reflecting on: Python # Clean and readable always wins def find_max(numbers): return max(numbers) if numbers else None JavaScript // Simplicity > over-engineering const uniqueItems = arr => [...new Set(arr)]; SQL -- Good queries save hours later SELECT customer_id, COUNT(*) AS total_orders FROM orders GROUP BY customer_id ORDER BY total_orders DESC; Nothing fancy here — but that’s the point. The real difference often comes from writing code that: someone else can understand quickly you can debug without frustration actually scales without breaking everything Tech keeps evolving, but clarity, structure, and logic never go out of style. Curious — what’s one coding principle you always stick to, no matter the language or stack? #Coding #Technology #SoftwareDevelopment #CleanCode #Programming #Developers
To view or add a comment, sign in
-
🚀 Day 14 of 100 Days LeetCode Challenge Problem: The K-th Lexicographical String of All Happy Strings of Length n Today’s problem is a perfect blend of Backtracking + Lexicographical Ordering 🔥 💡 Key Insight: A happy string: Uses only 'a', 'b', 'c' No two adjacent characters are the same 👉 Instead of generating all strings blindly, we: Build valid strings using backtracking Maintain lexicographical order naturally 🔍 Core Approach: 1️⃣ Backtracking (DFS) Start building string character by character At each step: Choose from 'a', 'b', 'c' Skip if same as previous character 2️⃣ Lexicographical Order Always try characters in order: 'a' → 'b' → 'c' 3️⃣ Stop Early Once we reach the k-th string, stop recursion 👉 If total strings < k → return "" 🔥 What I Learned Today: Backtracking is powerful for constraint-based generation Ordering decisions early helps avoid extra sorting Early stopping = major optimization 📈 Challenge Progress: Day 14/100 ✅ 2 weeks strong! LeetCode, Backtracking, Recursion, Lexicographical Order, Strings, DFS, DSA Practice, Coding Challenge, Problem Solving #100DaysOfCode #LeetCode #DSA #CodingChallenge #Backtracking #Recursion #Strings #ProblemSolving #TechJourney #ProgrammerLife #SoftwareDeveloper #CodingLife #LearnToCode #Developers #Consistency #GrowthMindset #InterviewPrep
To view or add a comment, sign in
-
-
Longer autonomous coding runs lead to longer reviews. This is how you make them fast again. Your bug count may be infinite but your threat model is finite. If you build a TypeScript and Python app you likely have SSRF (when your server makes HTTP requests on behalf of the user) and missing/incorrect authorization bugs. The road to asurance AND velocity is paved with ”define and conquer”. Define an input filter for URLs and scan for fetch and request lib calls that don't use it. This can be a lint rule. Your app roles have purposes and flows. Define these to make an allowed calls definition. Peak into the tests/ directory for playwright tests that you can use to reach all features with lower than expected roles. Clear definitions and types are what makes things verifiable at speed.
To view or add a comment, sign in
-
-
🚀 Day 32 of My Coding Journey — Mastering Binary Search Today I solved the classic Binary Search problem (LeetCode 704), and it reinforced one important concept: 👉 Divide and conquer can turn O(n) problems into O(log n). 💡 What I practiced today: Iterative Binary Search (most optimal & commonly used) Recursive Binary Search (clean logic, but uses stack space) 🔍 Key Learning: Instead of scanning the whole array, we eliminate half of the search space in every step. That’s why Binary Search is extremely powerful for sorted data. 📌 Approach (Recursive): Find mid index Compare with target If smaller → search right half If larger → search left half Stop when low > high ⚡ Time Complexity: O(log n) ⚡ Space Complexity: Iterative → O(1) Recursive → O(log n) (due to call stack) 💭 My Takeaway: Binary Search looks simple, but mastering edge cases (like overflow in mid, base conditions) is what actually matters in interviews. 📈 Slowly building strong fundamentals for problem solving and technical interviews. #Day32 #DSA #BinarySearch #CodingJourney #LeetCode #ProblemSolving #TechLearning
To view or add a comment, sign in
-
-
Have you ever struggled with complex search conditions in your code? I know I have. In a recent project, our team had to implement a search function that could handle multiple criteria, including keywords, categories, and date ranges. We used Lookahead to simplify the process. Here's a rule of thumb: break down your search conditions into smaller, manageable parts. However, juniors often fall into the pitfall of overcomplicating their regex patterns. Keep it simple and test thoroughly. With Lookahead, you can make your search functions more efficient and scalable. So, don't be afraid to give it a try. #programming #webdev #Lookahead
To view or add a comment, sign in
-
-
🚀 Day 7 of My LeetCode Journey — Sorting Fundamentals Today I focused on two classic sorting algorithms: 🔹 Bubble Sort 🔹 Selection Sort 💡 Bubble Sort The idea is simple: 👉 Compare adjacent elements 👉 Swap if they are in the wrong order 👉 Repeat until the array is sorted It’s easy to understand, but not efficient for large datasets. ⏱️ Time Complexity: O(n²) 💡 Selection Sort A slightly different approach: 👉 Find the minimum element 👉 Place it at the correct position 👉 Repeat for the rest of the array Also simple, but still not optimal for big inputs. ⏱️ Time Complexity: O(n²) 🔥 Key Takeaways: These algorithms may not be optimal, but they build strong fundamentals Understanding how sorting works internally is more important than memorizing Optimization comes later — basics come first Big thanks to Namaste DSA and Akshay Saini 🚀 for guiding this journey Consistency is the real win — Day 8 loading 💪 #LeetCode #DataStructures #Algorithms #CodingJourney #100DaysOfCode #SoftwareEngineering #Programming #InterviewPrep #JavaScript #CodingLife #TechGrowth #ProblemSolving #Developers #LearnToCode #Sorting #BubbleSort #SelectionSort #NamasteDSA
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