𝗗𝗮𝘆 𝟯𝟰/𝟭𝟬𝟬 | 𝗠𝗶𝗱𝗱𝗹𝗲 𝗼𝗳 𝘁𝗵𝗲 𝗟𝗶𝗻𝗸𝗲𝗱 𝗟𝗶𝘀𝘁 Day 34 ✅ — Reinforcing yesterday's pattern. 𝗧𝗼𝗱𝗮𝘆'𝘀 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: ✅ 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 #𝟴𝟳𝟲: Middle of the Linked List (Easy) 𝗪𝗵𝗮𝘁 𝗖𝗹𝗶𝗰𝗸𝗲𝗱: Find the middle node of a linked list. Yesterday I deleted it, today I returned it. Same fast and slow pointer technique. Fast moves 2 steps, slow moves 1. When fast hits the end, slow is at the middle. 𝗠𝘆 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵: 👉 slow = head, fast = head 👉 Move fast by 2, slow by 1 👉 Return slow when fast reaches end Time: O(n), Space: O(1) 𝗠𝘆 𝗥𝗲𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻: Repetition builds mastery. Same pattern, different problem. This is how you internalize techniques for coding interviews. Five linked list problems in a row. The two-pointer pattern is now muscle memory. 𝗖𝗼𝗱𝗲:🔗 https://lnkd.in/gCd-B7Um 𝗗𝗮𝘆 𝟯𝟰/𝟭𝟬𝟬 ✅ | 𝟲𝟲 𝗺𝗼𝗿𝗲 𝘁𝗼 𝗴𝗼! #100DaysOfCode #LeetCode #LinkedList #TwoPointer #FastAndSlowPointer #DataStructures #CodingInterview #FAANG #SoftwareEngineer #Java #Algorithms #Programming #PatternRecognition
More Relevant Posts
-
🚀 Day 14 – LeetCode #13: Roman to Integer | Mastering String Parsing Today’s problem looks easy at first glance… but it exposes whether you really understand character mapping, edge cases, and sequential logic. 🔹 Problem: Convert a Roman numeral (I, V, X, L, C, D, M) into its integer value. Sounds simple — until you hit tricky cases like: IV = 4 (not 6) IX = 9 XL = 40 CM = 900 If you blindly add values, you’ll get wrong answers. You must detect when a smaller value appears before a bigger one → subtract instead of add. 💡 Core idea: Map each symbol → integer Traverse left → right If current < next → subtract Else → add This problem trains: ✅ HashMap usage ✅ String traversal ✅ Greedy thinking ✅ Edge-case handling ✅ Clean conditional logic Stop memorizing. Understand the rule. That’s what interviews test. Consistency > talent. Day 14 done. On to Day 15. #LeetCode #DSA #Java #CodingInterview #ProblemSolving #100DaysOfCode #SoftwareEngineer #Developers #TechCareer #LearningInPublic #Algorithms
To view or add a comment, sign in
-
𝗗𝗮𝘆 𝟰𝟬/𝟭𝟬𝟬 | 𝗗𝗼𝘂𝗯𝗹𝗲 𝗮 𝗡𝘂𝗺𝗯𝗲𝗿 𝗥𝗲𝗽𝗿𝗲𝘀𝗲𝗻𝘁𝗲𝗱 𝗮𝘀 𝗮 𝗟𝗶𝗻𝗸𝗲𝗱 𝗟𝗶𝘀𝘁 🎉 Day 40 ✅ — 𝟰𝟬% 𝗰𝗼𝗺𝗽𝗹𝗲𝘁𝗲. 𝗘𝗹𝗲𝘃𝗲𝗻 𝗹𝗶𝗻𝗸𝗲𝗱 𝗹𝗶𝘀𝘁 𝗽𝗿𝗼𝗯𝗹𝗲𝗺𝘀 𝘀𝘁𝗿𝗮𝗶𝗴𝗵𝘁. 𝗧𝗼𝗱𝗮𝘆'𝘀 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: ✅ 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 #𝟮𝟴𝟭𝟲: Double a Number Represented as a Linked List (Medium) 𝗪𝗵𝗮𝘁 𝗖𝗹𝗶𝗰𝗸𝗲𝗱: Double a number stored in a linked list (digits in order). Handle carry propagation like manual multiplication. My approach combined patterns from the past 11 days: Reverse the list (Day 31, 39) Process digit by digit with carry Reverse back to original order Three operations, one solution. The linked list fundamentals are locked in. 𝗠𝘆 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵: 👉 Reverse the linked list 👉 Multiply each digit by 2, handle carry 👉 If final carry exists, add new node 👉 Reverse back to original order Time: O(n), Space: O(1) 𝗠𝘆 𝗥𝗲𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻: Eleven consecutive linked list problems (Day 30-40). What started as practice became mastery. 40 days. 40 problems. 40% complete. The consistency compounds. 𝗖𝗼𝗱𝗲:🔗 https://lnkd.in/gbmeVK36 𝟰𝟬 𝗱𝗮𝘆𝘀. 𝗧𝘄𝗼-𝗳𝗶𝗳𝘁𝗵𝘀 𝗱𝗼𝗻𝗲. 🎯 To everyone on their journey: small daily actions → massive results. Keep going. 𝗗𝗮𝘆 𝟰𝟬/𝟭𝟬𝟬 ✅ | 𝟲𝟬 𝗺𝗼𝗿𝗲 𝘁𝗼 𝗴𝗼! #100DaysOfCode #LeetCode #LinkedList #MathematicalAlgorithms #DataStructures #CodingInterview #SoftwareEngineer #Java #Algorithms #MediumLevel #Programming #40DayMilestone #Consistency #TechCareers
To view or add a comment, sign in
-
🚀 Day 13 – LeetCode 60 Days Challenge Problem Solved: 4 Sum Today I solved the classic 4Sum problem using Sorting + Two Pointer technique. 🔹 Problem: Given an array of integers, return all unique quadruplets such that: nums[i] + nums[j] + nums[left] + nums[right] == target 🔹 Approach I Used: 1️⃣ First, sort the array. 2️⃣ Fix the first element using loop (i). 3️⃣ Fix the second element using loop (j). 4️⃣ Use two pointers (left & right) for remaining two elements. 5️⃣ Carefully skip duplicates to avoid repeated quadruplets. 6️⃣ Used long for sum to avoid integer overflow. This reduces the brute force O(n^4) solution to: ⏱ Time Complexity: O(n^3) 📦 Space Complexity: O(1) (excluding result list) 🔹 Key Learning: - Two pointer technique becomes powerful after sorting. - Duplicate handling is VERY important in combination problems. - Always consider overflow when dealing with large integers. - Pattern recognition: 4Sum is an extension of 3Sum. 💡 Interview Insight: Most interviewers expect you to: ✔ First explain brute force ✔ Then optimize step by step ✔ Handle duplicates properly ✔ Think about overflow edge cases Consistency > Motivation 🔥 Day 13 Done ✅ On to Day 14 🚀 #LeetCode #Java #DSA #ProblemSolving #CodingJourney #InterviewPreparation
To view or add a comment, sign in
-
-
𝗗𝗮𝘆 𝟱𝟭/𝟭𝟬𝟬 | 𝗜𝗻𝘀𝗲𝗿𝘁𝗶𝗼𝗻 𝗦𝗼𝗿𝘁 𝗟𝗶𝘀𝘁 Day 51 ✅ — Second half begins. 𝗧𝗼𝗱𝗮𝘆'𝘀 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: ✅ 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 #𝟭𝟰𝟳: Insertion Sort List (Medium) 𝗪𝗵𝗮𝘁 𝗖𝗹𝗶𝗰𝗸𝗲𝗱: Sort a linked list using insertion sort. The algorithm everyone learns with arrays—now applied to pointers. For each unsorted node, find its correct position in the sorted portion and insert it there. The dummy node pattern made this clean—find the insertion point, adjust pointers, move forward. Day 51. The second half of the journey starts here. 𝗠𝘆 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵: 👉 Dummy node for sorted list head 👉 Keep sorted and unsorted portions 👉 For each unsorted node, find insertion position 👉 Adjust pointers to insert node 👉 Continue until entire list is sorted Time: O(n²), Space: O(1) 𝗠𝘆 𝗥𝗲𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻: Twenty-two linked list problems. Insertion sort on arrays is basic. On linked lists? It tests if you truly understand pointer manipulation. Yesterday was celebration. Today is execution.𝟰𝟵 𝗺𝗼𝗿𝗲 𝗱𝗮𝘆𝘀. 𝗟𝗲𝘁'𝘀 𝗴𝗼. 𝗖𝗼𝗱𝗲:🔗 https://lnkd.in/gR6h_43V 𝗗𝗮𝘆 𝟱𝟭/𝟭𝟬𝟬 ✅ | 𝟰𝟵 𝗺𝗼𝗿𝗲 𝘁𝗼 𝗴𝗼! #100DaysOfCode #LeetCode #LinkedList #InsertionSort #SortingAlgorithms #DataStructures #CodingInterview #SoftwareEngineer #Java #Algorithms #Programming #SecondHalf
To view or add a comment, sign in
-
🚀 Day 21 – LeetCode Challenge Problem: 16. 3Sum Closest Today’s problem looked simple at first, but a brute-force solution (O(n³)) is unacceptable in interviews. The real goal is recognizing the pattern and optimizing. ✅ Key Idea: • Sort the array • Fix one element • Use two pointers (left & right) • Shrink the window to approach the target This reduces complexity from O(n³) → O(n²) What I practiced today: ✔ Two-pointer technique mastery ✔ Edge case handling ✔ Updating the closest sum efficiently ✔ Thinking in terms of optimization, not brute force 💡 Lesson learned: Most medium problems are just pattern recognition. If you know: • Sorting • Two pointers • Sliding window Half of LeetCode becomes mechanical. Consistency > Motivation. 21 days straight. No skips. #LeetCode #DataStructures #Algorithms #Java #CodingInterview #SoftwareEngineer #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
🚀 Day 10/100 – First Missing Positive | LeetCode (Hard) Double digits in my #100DaysOfChallenges journey! Today’s challenge was a classic interview problem that tests array manipulation + in-place hashing logic. 🧩 Problem: Given an unsorted integer array, return the smallest missing positive integer. Constraints: Must run in O(n) time Use O(1) extra space 🧠 Approach Used: Cyclic Sort (Index Placement Technique) Instead of using extra space like HashSet, I used an in-place strategy: ✔️ Place each number x at index x - 1 ✔️ Ignore negative numbers and numbers > n ✔️ Swap until every valid number is in its correct position ✔️ Scan the array to find the first index where nums[i] != i + 1 Core Idea: If 1 is at index 0, 2 at index 1, etc., The first mismatch gives the missing positive. 💡 Why This Is Smart: It uses the array itself as a hash structure No extra memory required Maintains linear time complexity ⏱ Complexity: Time: O(n) Space: O(1) 🎯 Key Learning: In-place hashing is powerful Hard problems often combine simple ideas cleverly Edge cases (negatives, duplicates, large values) matter a lot This problem strengthened my: 👉 Index mapping intuition 👉 Optimization mindset 👉 Confidence in solving Hard-level problems 90 days to go 🚀 #100DaysOfCode #LeetCode #DSA #Arrays #CyclicSort #Java #ProblemSolving #TechGrowth #AIML
To view or add a comment, sign in
-
-
📌 LeetCode Daily Challenge — Day 2 Problem: 1536. Minimum Swaps to Arrange a Binary Grid Topic: Greedy, Array, Matrix 🔑 The Core Insight: For a grid to be valid, row i must have at least n-1-i trailing zeros. That single observation turns a complex matrix problem into a straightforward Greedy scan! 🛠️ The Approach: ✅ Count trailing zeros for each row ✅ Greedily find the closest row that satisfies each position ✅ Bubble it up using adjacent swaps ✅ If no valid row exists → return -1 ⚡ Complexity: → Time: O(n²) | Space: O(n) → One pass greedy. Clean. Efficient. No drama. 💡 Biggest Takeaway: The hardest part wasn't the code it is seeing the pattern. Once you realize each row has a trailing zero requirement, everything else falls into place naturally. 📖 Want the full breakdown with dry runs, code walkthrough, and complexity analysis? I've documented everything in detail my medium page, check it out here: 👉 https://lnkd.in/gK_9_D47 If you solved it using different approach, I’d love to hear it. Drop your thoughts in comments. See you in the next problem👋 #LeetCode #DSA #Greedy #Java #ProblemSolving #SoftwareEngineering #CodingInterview #Tech #Engineering
To view or add a comment, sign in
-
🚀 Solved: Chocolate Distribution Problem (Greedy + Sorting) Today I solved an interesting problem based on Sorting and Sliding Window technique. 🧩 Problem Statement: Given an array where each element represents the number of chocolates in a packet, and m students, distribute exactly one packet to each student such that the difference between the maximum and minimum chocolates given is minimum. 💡 Key Insight: After sorting the array, the minimum difference will always be found among m consecutive elements. 🔎 Approach: 1️⃣ Sort the array 2️⃣ Use a sliding window of size m 3️⃣ Compute arr[i + m - 1] - arr[i] 4️⃣ Track the minimum difference ⏱ Time Complexity: O(n log n) due to sorting 🧠 What I Learned: Importance of recognizing greedy patterns How sorting simplifies range-based problems Practical use of sliding window technique Problems like these strengthen core DSA fundamentals and interview confidence 💪 #DataStructures #Algorithms #Java #CodingInterview #ProblemSolving #GreedyAlgorithm #Sorting #SlidingWindow #100DaysOfCode #DSAPractice
To view or add a comment, sign in
-
-
🚀 Day 18/30 – Recognizing Patterns in a Single Pass Today’s problem was about finding the longest mountain in an array — a subarray that strictly increases and then strictly decreases. The real challenge was not just identifying the pattern, but doing it efficiently in one traversal. 💡 Approach Skip flat and decreasing sequences Detect the start of an increasing slope Count the upward climb Count the downward descent Update the maximum length only when both exist This ensures: ⏱ O(n) time complexity 📦 O(1) space complexity 📊 Performance ✅ All test cases passed ⚡ 2 ms runtime (Beats 99.57%) 💾 Efficient memory usage 📚 Key Takeaway This problem improved my ability to: Break complex patterns into simple state transitions Think in terms of phases (uphill → downhill) Solve without extra arrays or nested loops The biggest learning today: 👉 Many array problems are about state management during traversal, not brute force. 🎯 Day 18 complete. Each day is making pattern recognition faster and more intuitive — which is critical for coding interviews. #Day18 #30DaysOfCode #LeetCode #Java #Algorithms #ArrayProblems #ProblemSolving #InterviewPreparation #SoftwareEngineering #CodingJourney #Consistency #TechGrowth
To view or add a comment, sign in
-
-
🚀 Day 27 of My DSA Journey – Merge Sorted Array (Two-Pointer Technique) Today I solved the classic “Merge Sorted Array” problem from LeetCode. The challenge wasn’t just merging two sorted arrays — it was doing it in: ⏱ O(m + n) time 📦 O(1) extra space And modifying nums1 in-place. At first, sorting after merging seems easy. But interviews test optimization, not convenience. 💡 Key Insight: Instead of merging from the beginning (which would overwrite values), I used the two-pointer technique from the end. By comparing elements from the back and filling the largest values first, I avoided extra space and maintained sorted order efficiently. What this strengthened: • Two-pointer mastery • In-place array manipulation • Edge case handling (m = 0, n = 0) • Thinking about constraints before coding This problem reinforced something important: “Easy” problems often test your fundamentals more than complex ones. Consistency continues. One problem better than yesterday. 💪 #Day27 #DSA #Java #TwoPointers #ProblemSolving #InterviewPrep #SoftwareEngineering #CodingJourney #GrowthMindset
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