𝗗𝗮𝘆 𝟰𝟵/𝟭𝟬𝟬 | 𝗥𝗲𝗺𝗼𝘃𝗲 𝗗𝘂𝗽𝗹𝗶𝗰𝗮𝘁𝗲𝘀 𝗳𝗿𝗼𝗺 𝗦𝗼𝗿𝘁𝗲𝗱 𝗟𝗶𝘀𝘁 𝗜𝗜 Day 49 ✅ — One day from halfway. 𝗧𝗼𝗱𝗮𝘆'𝘀 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: ✅ 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 #𝟴𝟮: Remove Duplicates from Sorted List II (Medium) 𝗪𝗵𝗮𝘁 𝗖𝗹𝗶𝗰𝗸𝗲𝗱: Remove ALL nodes that have duplicates, not just the extras. If a value appears twice, remove both occurrences. Day 35: Kept one copy of duplicates. Day 49: Remove all duplicates entirely. The difference? An inner while loop to skip ALL duplicate values, then reconnect prev to the node after the duplicate chain. 𝗠𝘆 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵: 👉 Dummy node for clean head handling 👉 Detect duplicates: curr.val == curr.next.val 👉 Inner loop: skip ALL duplicate nodes 👉 Reconnect: prev.next = curr.next 👉 Move forward only when no duplicates found Time: O(n), Space: O(1) 𝗠𝘆 𝗥𝗲𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻: Twenty linked list problems (Day 30-49). The progression from Day 35's "keep one" to Day 49's "remove all" shows how small changes in requirements test true understanding. Tomorrow: Day 50. Halfway milestone. The journey continues. 𝗖𝗼𝗱𝗲:🔗 https://lnkd.in/g-tqpNVB 𝗗𝗮𝘆 𝟰𝟵/𝟭𝟬𝟬 ✅ | 𝟱𝟭 𝗺𝗼𝗿𝗲 𝘁𝗼 𝗴𝗼! #100DaysOfCode #LeetCode #LinkedList #DataStructures #CodingInterview #SoftwareEngineer #Java #Algorithms #Programming #AlmostHalfway #Day50Tomorrow
More Relevant Posts
-
𝗗𝗮𝘆 𝟱𝟭/𝟭𝟬𝟬 | 𝗜𝗻𝘀𝗲𝗿𝘁𝗶𝗼𝗻 𝗦𝗼𝗿𝘁 𝗟𝗶𝘀𝘁 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 22/30 – Product of Array Except Self Today’s challenge was to compute an array where each element represents the product of all other elements except itself, without using division and in O(n) time. 💡 Key Insight A naive solution would use division or nested loops, but that either: ❌ Breaks when zero exists ❌ Takes O(n²) time So I used the prefix & suffix product technique. ⚙️ Approach First pass → store left (prefix) product for each index Second pass → multiply with right (suffix) product No division used Constant extra space (excluding output array) ⏱ Complexity Time Complexity: O(n) Space Complexity: O(1) (optimal as per problem constraint) 📊 Performance ✅ All test cases passed ⚡ Faster than 94% of submissions 🧠 Interview-optimal solution 📚 What I Learned This problem strengthened my understanding of: Prefix sum/product patterns Space optimization techniques How to avoid division using traversal logic 📈 Growth Reflection Earlier, I used to think in terms of direct computation. Now I automatically look for: 👉 “Can I precompute values from left and right?” That shift in thinking is the real progress. 🎯 Day 22 complete — moving deeper into core array patterns. #Day22 #30DaysOfCode #LeetCode #Java #Arrays #PrefixSuffix #InterviewPreparation #ProblemSolving #CodingJourney #Consistency #TechGrowth
To view or add a comment, sign in
-
-
Day 15/100 – LeetCode Challenge Problem Solved: Rotate Image Today’s problem involved rotating an n × n matrix by 90 degrees clockwise without using additional space. The challenge is performing the transformation directly on the existing matrix. The key idea behind the solution is breaking the rotation into two simpler operations. First, transpose the matrix by swapping elements across the main diagonal. This converts rows into columns. After the transpose, reverse each row of the matrix. Together, these two steps effectively rotate the matrix by 90 degrees clockwise. This approach avoids creating a new matrix and performs all operations in-place, which satisfies the constraint of constant extra space. Time Complexity: O(n²) Space Complexity: O(1) Performance: Runtime 0 ms Key takeaway: Complex matrix transformations often become easier when decomposed into simpler operations like transpose and reversal. Day 15 completed. Staying consistent and continuing to strengthen problem-solving skills. #100DaysOfLeetCode #Java #Algorithms #Matrix #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
#100DaysOfLeetcode journey 🚀 Day 20/100 — Bit Manipulation & Modular Arithmetic! Today’s Problem: 1680. Concatenation of Consecutive Binary Numbers 🔹 The Goal: Given an integer $n$, concatenate the binary representations of numbers from $1$ to $n$ into a single string and return its decimal value modulo $10^9 + 7$. 🔹 The Insight: At first glance, this looks like a string problem, but building a massive binary string is a recipe for a Memory Limit Exceeded (MLE) error. The trick is to realize that when you "append" a new number $i$ to your current result, you are essentially shifting your current value to the left by the number of bits in $i$ and then adding $i$. 🔹 The Difficulty: The numbers grow exponentially. To keep things under control, we apply the property of modular arithmetic: $$(A + B) \pmod M = ((A \pmod M) + (B \pmod M)) \pmod M$$ The real challenge? Knowing when the "bit length" of your current number increases (e.g., when moving from 3 to 4, you go from 2 bits to 3 bits). ✨ Achievement: Successfully bypassed string manipulation entirely to create a pure mathematical $O(n)$ solution. 🔍 Steps followed: ✔ Bit-Width Tracking: Monitored when $i$ reached a power of 2 to increment the shift amount. ✔ Efficient Shifting: Used (ans << bitLength) | i to concatenate values at the bit level. ✔ Modular Discipline: Applied the modulo at every step to prevent integer overflow. 🔧 Complexity Analysis: Time Complexity: $O(n)$ Space Complexity: $O(1)$ Thirteen days in and the "bit-shifting" logic is starting to feel like second nature. Onward! 🛠️ #Java #DSA #LeetCode #CodingJourney #100DaysOfCode #BitManipulation #MathAlgorithms #SoftwareEngineer #Optimization
To view or add a comment, sign in
-
-
🚀 Day 20/30 – Making Strings Valid with Minimum Removals Today’s problem focused on removing the minimum number of parentheses to make a string valid. What made it interesting was balancing correctness with efficiency while preserving the original character order. 💡 Approach Traverse the string and track unmatched parentheses Mark invalid positions instead of rebuilding the string repeatedly Construct the final result in a single pass This ensures: ⏱ O(n) time complexity 📦 O(n) space complexity 📊 Performance ✅ All test cases passed ⚡ 5 ms runtime (Beats 99.89%) 💾 Efficient memory usage 📚 Key Takeaway This problem strengthened my understanding of: Using stacks / counters for validation Avoiding unnecessary string reconstruction Thinking in terms of minimum removals instead of full recomputation 🔍 What I Would Optimize Next Exploring alternate implementations that reduce auxiliary space while keeping the logic readable. 🎯 Day 20 complete – 2/3 of the challenge done. The focus now is on solving Medium problems faster and recognizing patterns earlier. #Day20 #30DaysOfCode #LeetCode #Java #Algorithms #Stacks #StringManipulation #ProblemSolving #InterviewPreparation #SoftwareEngineering #CodingJourney #Consistency #TechGrowth
To view or add a comment, sign in
-
-
🚀 Day 78 / 100 – LeetCode Daily Challenge 🧠 Problem: Triconic Subarray Maximum Sum 📅 Date: March 7, 2026 🏆 Runtime: 3 ms | Beats 99.94% 📦 Memory: 95.28 MB | Beats 46.16% 📝 Problem Insight Today’s challenge was to find the maximum sum of a triconic subarray – a sequence that first decreases, then increases, and finally decreases again. It’s like a "mountain" with two peaks and one valley in between, but in a specific order: down → up → down. This is a more complex variant of the classic mountain or bitonic subarray problems. It requires careful scanning of the array to detect valid triconic patterns and compute their sums efficiently. 💡 My Approach I used a two-pointer expansion method: Iterate through the array and treat each index as a potential peak or valley. Expand left and right while the pattern matches the triconic property. Keep track of the maximum sum encountered. Although the code snippet is incomplete here, the full solution involves: Precomputing left and right decreasing/increasing trends. Validating the three-phase pattern for each possible center. Avoiding redundant computations to keep the time complexity close to O(n). 📊 Results ✅ 861 / 861 test cases passed ⚡ Runtime: 3 ms (beats 99.94% of Java submissions) 📈 Memory: 95.28 MB (beats 46.16%) 🧠 Key Takeaway Pattern recognition problems like this one are great for sharpening your array traversal logic and understanding how to break down complex patterns into manageable checks. The challenge is not just in finding the sum, but in ensuring the pattern holds throughout. 🔗 Let’s Connect! I’m documenting my #100DaysOfCode journey every day – follow along for more problem-solving insights, optimizations, and LeetCode grind! 💻⚡ #LeetCode #Java #CodingChallenge #100DaysOfCode #Day78 #TriconicArray #ProblemSolving #TechJourney #SoftwareEngineering #Algorithms #DataStructures #CodeNewbie #DevCommunity #Programming
To view or add a comment, sign in
-
-
🚀 100 Day Target – Day 13 Problem: Find the Duplicate Number Concept: Cyclic Sort | Index Mapping Today’s focus was on detecting duplicates without modifying constraints or using extra space unnecessarily. Instead of brute force or sorting, applied index placement logic to identify the duplicate efficiently. Key Learnings: ✔ Understanding constraints changes the approach ✔ In-place techniques improve space efficiency ✔ Strong array fundamentals simplify tricky problems From basics to optimized thinking — every day sharpening problem-solving instincts. The streak continues. 💪🔥 #100DaysOfCode #DSA #Java #Arrays #CyclicSort #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
𝗗𝗮𝘆 𝟳𝟬/𝟭𝟬𝟬 — 𝟳𝟬% 𝗖𝗢𝗠𝗣𝗟𝗘𝗧𝗘 🎉 70 days. 70 problems. 70% done. 𝗜 𝗱𝗶𝗱𝗻'𝘁 𝗾𝘂𝗶𝘁. 𝗧𝗼𝗱𝗮𝘆'𝘀 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: ✅ #𝟭𝟵𝟭𝟬: Remove All Occurrences of a Substring (Medium) 𝗧𝗵𝗲 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: Remove all occurrences of a substring from a string. Keep removing until no more exist. Example: s = "daabcbaabcbc", part = "abc" → "dab" Stack behavior again. Build string character by character. Check the end for pattern matches. Remove when found. 𝗠𝘆 𝗦𝗼𝗹𝘂𝘁𝗶𝗼𝗻: StringBuilder as stack. For each character: Append it Check if the last m characters match the pattern If yes, delete them Continue Time: O(n × m), Space: O(n) 𝗪𝗵𝗮𝘁 𝟳𝟬 𝗗𝗮𝘆𝘀 𝗧𝗮𝘂𝗴𝗵𝘁 𝗠𝗲: 𝗗𝗮𝘆 𝟭: Basic arrays felt hard 𝗗𝗮𝘆 𝟯𝟬: Started linked lists, struggled 𝗗𝗮𝘆 𝟱𝟬: Linked lists = second nature 𝗗𝗮𝘆 𝟲𝟬: Stacks, queues, patterns everywhere 𝗗𝗮𝘆 𝟳𝟬: Combining patterns feels natural The progression is real. The compound effect is real. 𝗧𝗵𝗲 𝗧𝗿𝘂𝘁𝗵: 70 days ago, I wasn't sure I could finish this. Some days I didn't want to code. Some days felt pointless. But I showed up anyway. 𝗧𝗵𝗮𝘁'𝘀 𝘁𝗵𝗲 𝘀𝗸𝗶𝗹𝗹 𝘁𝗵𝗮𝘁 𝗺𝗮𝘁𝘁𝗲𝗿𝘀—not talent, not motivation, but showing up when you don't feel like it. 𝗖𝗼𝗱𝗲: https://lnkd.in/gd-QRcxU 𝟳𝟬 𝗱𝗼𝘄𝗻. 𝟯𝟬 𝘁𝗼 𝗴𝗼. 70% complete. The finish line is close. Let's bring this home. 𝗗𝗮𝘆 𝟳𝟬/𝟭𝟬𝟬 ✅ #100DaysOfCode #LeetCode #70DayMilestone #Consistency #Stack #Algorithms #CodingChallenge #Programming #Java #NeverQuit #GrowthMindset #70Percent #AlmostThere
To view or add a comment, sign in
-
🚀 Day 521 of #750DaysOfCode 🚀 🔎 1582. Special Positions in a Binary Matrix (LeetCode - Easy) Today I solved a simple yet interesting matrix traversal problem. 🧠 Problem Summary We are given an m × n binary matrix. A position (i, j) is called special if: ✔ mat[i][j] == 1 ✔ All other elements in row i are 0 ✔ All other elements in column j are 0 Our task is to count how many such special positions exist. 💡 Key Idea Instead of checking the entire row and column every time, we can: 1️⃣ Count the number of 1s in every row 2️⃣ Count the number of 1s in every column Then a cell (i, j) is special if: mat[i][j] == 1 rowCount[i] == 1 colCount[j] == 1 ⏱ Time Complexity O(m × n) We traverse the matrix twice. 🧩 What I Learned ✔ Efficiently using row and column counting ✔ Simplifying matrix conditions with precomputation ✔ Writing cleaner solutions for matrix-based problems Step by step progress every day. Consistency is the real key. 🚀 #LeetCode #Java #MatrixProblems #ProblemSolving #DataStructures #CodingJourney #750DaysOfCode #Day521
To view or add a comment, sign in
-
-
Day 7 🚀 of the #100DaysOfLeetCode challenge Problem 88: Merge Sorted Array Today’s focus was on in-place merging using the insertion and shifting approach. Instead of using an extra array, I compared elements from nums1 and nums2. Whenever an element from nums2 was smaller, I shifted the remaining elements in nums1 to the right and inserted it at the correct position. After each insertion, I updated the effective size of nums1 and continued the process until all elements were merged. This approach helped me clearly understand: -->How in-place array manipulation works -->Why boundary management (m and n) is critical -->How shifting impacts time complexity Time Complexity: O(m × n) in worst case due to shifting Space Complexity: O(1) (no extra space used) Even though there’s a more optimal two-pointer solution from the back (O(m + n)), practicing this method strengthened my fundamentals in array handling and index control. Every problem teaches something beyond just passing test cases. Consistency > Intensity. #LeetCode #Java #DataStructures #ProblemSolving #CodingJourney #100DaysOfCode
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