🚀 Day 7/100 – #100DaysOfDSA One week in! 🎯 Today I focused on understanding basic sorting algorithms and how they work internally. 🔹 Problems Covered: 1. Selection Sort 2. Insertion Sort 💡 Key Learnings: 👉 Selection Sort Repeatedly find the minimum element from the unsorted part Place it at the correct position ✅ Time Complexity: O(n²) ✅ Space Complexity: O(1) (In-place) 👉 Insertion Sort Build the sorted array one element at a time Insert each element into its correct position ✅ Time Complexity: Best: O(n) (already sorted) Average/Worst: O(n²) ✅ Space Complexity: O(1) 🔥 What I learned today: Both algorithms are simple and useful for learning, but Insertion Sort performs better for partially sorted arrays, while Selection Sort always takes the same time. Understanding these basics helps in mastering advanced sorting algorithms later 🚀 Week 1 complete ✅ Consistency continues! #100DaysOfCode #DSA #Sorting #SelectionSort #InsertionSort #CodingJourney #ProblemSolving #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic
Rakesh kr.’s Post
More Relevant Posts
-
🚀 Day 8/100 – #100DaysOfDSA Today’s challenge pushed me to go beyond basic sorting and think about efficient algorithms with optimal time complexity. 🔹 Problem Solved: Sort an Array(Merge sort) (without using built-in functions) 💡 Key Learning: 👉 To achieve O(n log n) time complexity, we need to use advanced sorting algorithms like: Merge Sort (Divide & Conquer) Quick Sort (Partition-based approach) 👉 Approach I focused on: Merge Sort Divide the array into halves Recursively sort each half Merge the sorted halves ✅ Time Complexity: O(n log n) ✅ Stable sorting algorithm ⚠️ Space Complexity: O(n) (extra space required) 🔥 Alternative: Quick Sort Faster in practice (on average) Works in-place ⚠️ Worst case: O(n²) ✅ Average: O(n log n) 🔥 What I learned today: Not all sorting algorithms are equal — choosing the right one depends on constraints like time, space, and input size. Moving from basic → advanced concepts step by step 🚀 #100DaysOfCode #DSA #Sorting #MergeSort #QuickSort #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic
To view or add a comment, sign in
-
🚀 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 7 of my DSA journey Making real progress! Today was all about moving beyond the 'for' loop and diving deep into the fundamentals of Recursion. 💻 Recursion is a technique where a function calls itself to solve a problem by breaking it down into smaller, identical sub-problems. ✅ The Anatomy of Recursion: 🔹 Base Case: Your exit strategy. The mandatory condition that stops the cycle once the goal is reached. 🔹 Recursive Step: The logic where the function calls itself with a modified input, moving closer to the base case. 🔹 The Call Stack: The memory’s "waiting room." Every call sits on top of the previous one until the base case is hit and the stack "unwinds." ⚠️ Where It Goes Wrong: Stack Overflow: When the "waiting room" gets too full; too many calls without an exit will crash the memory. Infinite Loops: The result of a missing or unreachable base case, causing the program to hang. Excited to start solving recursion problems from tomorrow! 🚀 The goal has evolved: From simple loops to recursive logic, keeping the complexity low. On to Day 8! ➡️ #Day7 #JavaScript #DSA #LeetCode #Recursion #CodingJourney #LearningInPublic
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
-
🚀 Day 3/100 – #100DaysOfDSA Another day, more learning, and deeper understanding of in-place algorithms! 🔹 Problems Solved: Move Zeroes Merge Sorted Array 💡 Key Learnings: 👉 Problem 1: Move Zeroes Applied Two Pointer Technique One pointer tracks position for next non-zero element Another pointer iterates through the array Swap only when needed to maintain order ✅ Maintains relative order ✅ In-place (O(1) space) ✅ O(n) Time Complexity 👉 Problem 2: Merge Sorted Array Solved using reverse two-pointer approach Start filling from the end of nums1 (to avoid overwriting elements) Compare elements from nums1 and nums2, and place the larger one at the end ✅ Efficient merge without extra array ✅ O(m + n) Time ✅ In-place solution 🔥 What I learned today: Sometimes solving from the end instead of the beginning makes the problem much simpler and avoids unnecessary complexity. Consistency is building momentum. Day 3 done ✅ #100DaysOfCode #DSA #LeetCode #ProblemSolving #CodingJourney #SoftwareEngineer #JavaScript #TechGrowth #LearningInPublic #Developers
To view or add a comment, sign in
-
🚀 Day 28/50 – LeetCode Challenge 🧩 Problem: String Compression Today’s problem focused on modifying an array in-place while compressing repeated characters — a great exercise in two pointers and string manipulation. 📌 Problem Summary: Given an array of characters, compress it by replacing consecutive repeating characters with the character followed by its count. Example: Input: ["a","a","b","b","c","c","c"] Output: ["a","2","b","2","c","3"] The compression must be done in-place without using extra space. 🔍 Approach Used ✔ Used two pointers: one for reading characters one for writing compressed result ✔ Counted consecutive repeating characters ✔ Wrote the character and its count (if > 1) ✔ Continued until the end of the array ⏱ Time Complexity: O(n) 📦 Space Complexity: O(1) 💡 Key Learning ✔ In-place array manipulation ✔ Efficient use of two pointer technique ✔ Handling counts and conversions to string ✔ Writing optimized space-efficient solutions This problem highlights how careful pointer management can lead to efficient solutions. Consistency builds strong problem-solving skills 🚀 🔗 Problem Link: https://lnkd.in/geeBTB3P #50DaysOfLeetCode #LeetCode #DSA #TwoPointers #Strings #ProblemSolving #CodingJourney #FutureAIEngineer #Consistency
To view or add a comment, sign in
-
-
🚀 Day 5 of my DSA journey Building on the momentum! Today was all about using mathematical logic to solve array-based problems efficiently. 💻 ✅ Problems Solved & Key Takeaways: 1️⃣ Missing Number 🔹 Approach: Used the arithmetic series formula to calculate the expected sum of all numbers and subtracted the actual sum of the array to find the missing value. 🔹Learning: I learned that comparing an expected total against an actual total is a brilliant trick for identifying gaps in a sequence without needing to sort the data first. The goal remains the same: Stay consistent and keep optimizing. On to Day 6! ➡️ #Day5 #JavaScript #DSA #LeetCode #CodingJourney #LearningInPublic #SoftwareEngineering
To view or add a comment, sign in
-
🚀 LeetCode Daily Challenge 🔗 Problem: https://lnkd.in/g9SGp2Qa 💡 My thought process: First, create a mapping from each value to a sorted list of its indices using a map<int, vector<int>>. This allows for easy lookup of all positions where a value occurs. For each query index idx, it retrieves the corresponding value num. If that value appears only once, the result is -1 because no valid pair exists. In case of multiple occurrences, we use binary search on the index list of num: * upper_bound finds the next occurrence that is strictly greater than idx. * lower_bound locates the current position and checks the previous occurrence. It calculates distances in both directions: * Forward distance: either direct (next - idx) or circular wrap (n - (idx - first)). * Backward distance: either direct (idx - prev) or circular wrap (n - (last - idx)). The minimum of these distances is stored as the answer. 👉 My Solution: https://lnkd.in/gjmKVa3y If you found this breakdown helpful, feel free to ⭐ the repo or connect with me on LinkedIn 🙂🚀 #️⃣ #leetcode #cpp #dsa #coding #problemsolving #engineering #BDRM #BackendDevWithRahulMaheswari
To view or add a comment, sign in
-
-
I stopped solving random LeetCode problems. And suddenly… patterns started repeating. This week, I focused only on the Sliding Window. Not 50 problems. Just a few deeply. Here’s what I realized: Problems that looked completely different… were testing the same idea. • Minimum Size Subarray Sum • Fruits into Baskets • Subarray Product Less Than K • Maximum Points from Cards • Max Consecutive Ones • Longest Continuous Increasing Subsequence • Maximum Average Subarray I • Longest Mountain in Array Different stories. Same pattern. That’s when it clicked. Sliding Window isn’t a trick. It’s control. You’re not solving problems. You’re managing a window: Expand when conditions break. Shrink when constraints are satisfied. That’s it. Here are the signals I now look for instantly: • “Subarray” + “minimum/maximum” • “Continuous” or “longest” • Fixed vs variable window size • Constraint-driven shrinking Once you see it… you can’t unsee it. Next week, I’m starting Prefix Sums. Let’s see if the same thing happens again. Be honest :- Which DSA pattern took you the longest to truly understand? #DSA #LeetCode #SlidingWindow #CodingInterviews #ProblemSolving
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