𝗗𝗮𝘆 𝟰𝟬/𝟭𝟬𝟬 | 𝗗𝗼𝘂𝗯𝗹𝗲 𝗮 𝗡𝘂𝗺𝗯𝗲𝗿 𝗥𝗲𝗽𝗿𝗲𝘀𝗲𝗻𝘁𝗲𝗱 𝗮𝘀 𝗮 𝗟𝗶𝗻𝗸𝗲𝗱 𝗟𝗶𝘀𝘁 🎉 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
More Relevant Posts
-
🔥 Day 87 of #100DaysOfCode Today’s challenge: LeetCode: Implement Stack using Queues 📚🔁 📌 Problem Summary Implement a stack (LIFO) using only queue operations: push(x) pop() top() empty() You can only use standard queue operations (offer, poll, peek, isEmpty). 🧠 Approach: Two Queues Since stack is LIFO and queue is FIFO, we simulate stack behavior by rearranging elements during push. ⚙️ Strategy Used: Move all elements from q1 → q2 Add new element to q1 Move everything back from q2 → q1 Now: The newest element is always at the front of q1 pop() becomes simple → just q1.poll() 🔁 Key Idea Make push() costly Make pop() O(1) ⏱ Time Complexity push() → O(n) pop() → O(1) top() → O(1) empty() → O(1) 💾 Space Complexity: O(n) ⚡ Performance Runtime: 0 ms 100% faster than other submissions 🚀 💡 What I Learned Data structures can simulate each other. The trick is choosing where to handle the complexity. Understanding internal behavior matters more than memorizing code. Stack → Queue → Simulation mastery growing stronger 💪 On to Day 88 🔥 #100DaysOfCode #LeetCode #Stack #Queue #Java #DSA #InterviewPrep
To view or add a comment, sign in
-
-
Back on track after a short health break — consistency continues 💪 Day 12 of #100DaysOfCode 🚀 👉 LeetCode #15 – 3Sum (Medium) This problem really tests how well you can optimize brute-force thinking into an efficient solution. 🔹 Approach: First, sort the array Fix one element at a time Use two pointers (left & right) to find pairs with sum -nums[i] Carefully skip duplicates to avoid repeated triplets ⏱ Complexity: Time: O(n²) Space: O(1) (excluding output) 📌 Key Learnings: Sorting can simplify complex problems Two-pointer technique shines after sorting Handling duplicates is as important as core logic Medium problems demand clarity + patience, not shortcuts 💡 Takeaway: Optimization isn’t about writing less code — it’s about thinking smarter, step by step. Building strong DSA fundamentals in Java, one problem at a time. #LearnInPublic #DSA #Java #LeetCode #TwoPointers #ProblemSolving #CodingJourney #SoftwareEngineering #100DaysOfCode
To view or add a comment, sign in
-
-
𝗗𝗮𝘆 𝟰𝟵/𝟭𝟬𝟬 | 𝗥𝗲𝗺𝗼𝘃𝗲 𝗗𝘂𝗽𝗹𝗶𝗰𝗮𝘁𝗲𝘀 𝗳𝗿𝗼𝗺 𝗦𝗼𝗿𝘁𝗲𝗱 𝗟𝗶𝘀𝘁 𝗜𝗜 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
To view or add a comment, sign in
-
🚀 Day 14 – LeetCode 60 Days Challenge Problem Solved: Search Insert Position Today I solved the classic Binary Search problem – Search Insert Position. 🔹 Problem: Given a sorted array and a target value, return the index if the target exists. If not, return the index where it should be inserted to maintain sorted order. 🔹 Approach I Used: 1️⃣ Applied Binary Search (O(log n)) 2️⃣ Used while(start <= end) template 3️⃣ Carefully adjusted boundaries: - If nums[mid] < target → move start = mid + 1 - If nums[mid] > target → move end = mid - 1 4️⃣ If target is not found, return start as the correct insert position. 🔹 Key Insight: When the loop ends, start automatically points to the smallest index where the target can be placed without breaking sorted order. No extra condition needed. Binary Search naturally gives the insertion point. ⏱ Time Complexity: O(log n) 📦 Space Complexity: O(1) 🔹 Learning: - Never mix different binary search templates. - Choose one pattern and stick to it. - Boundary movement (mid - 1 vs mid) is VERY important. - Understanding loop termination is more important than memorizing code. Binary Search looks simple, but small boundary mistakes can break everything. Day 14 Done ✅ On to mastering Lower Bound & Upper Bound next 🚀 #LeetCode #BinarySearch #Java #DSA #InterviewPreparation #CodingJourney
To view or add a comment, sign in
-
-
🚀 𝗗𝗔𝗬 𝟭𝟭: 𝗡𝗘𝗦𝗧𝗘𝗗 𝗙𝗢𝗥 𝗟𝗢𝗢𝗣𝗦 – 𝗠𝗔𝗞𝗜𝗡𝗚 𝗦𝗘𝗡𝗦𝗘 𝗢𝗙 𝗣𝗔𝗧𝗧𝗘𝗥𝗡𝗦 🚀 Day 11 was all about Nested for Loops , and this topic changed how I look at pattern programs completely 💡 Earlier, I used to see patterns as something to memorise. Today I realized they are simply about understanding loop flow. 🔹 𝗪𝗛𝗔𝗧 𝗗𝗢𝗘𝗦 𝗡𝗘𝗦𝗧𝗘𝗗 𝗙𝗢𝗥 𝗟𝗢𝗢𝗣 𝗠𝗘𝗔𝗡? Nested for loop means writing one for loop inside another. • The outer loop decides how many times the structure repeats. • The inner loop decides what gets printed in each repetition. In simple words: 👉 One outer loop run = one complete inner loop run. 🔹 𝗨𝗡𝗗𝗘𝗥𝗦𝗧𝗔𝗡𝗗𝗜𝗡𝗚 𝗧𝗛𝗘 𝗙𝗟𝗢𝗪 A simple way to think: • Outer loop → number of lines • Inner loop → content inside each line If the outer loop runs 5 times and the inner loop runs 4 times, the inner code executes 20 times. 🔹 𝗣𝗥𝗔𝗖𝗧𝗜𝗖𝗔𝗟 𝗨𝗦𝗘 𝗖𝗔𝗦𝗘𝗦 Nested loops are commonly used when: • Printing star or number patterns • Working with tables • Handling matrix-style problems Whenever there is a row–column structure, nested loops are involved. 🔹 𝗟𝗘𝗦𝗦𝗢𝗡𝗦 𝗜 𝗟𝗘𝗔𝗥𝗡𝗘𝗗 𝗧𝗢𝗗𝗔𝗬 • Patterns don’t need memorization • Dry-running helps more than writing code directly • Understanding the loop flow saves a lot of confusion ✨ 𝗞𝗘𝗬 𝗧𝗔𝗞𝗘𝗔𝗪𝗔𝗬 Nested loops become easy once we stop focusing on symbols and start focusing on logic. One concept at a time. One step at a time 🚀 #Java #CoreJava #NestedLoops #ForLoop #JavaLearning #LearningInPublic #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
-
-
🚀 Day 19/30 – Finding Boundaries in a Sorted Array Today’s problem was about locating the first and last occurrence of a target element in a sorted array. What makes this problem interesting is not just finding the element — but correctly identifying its range. 💡 Approach I implemented a straightforward traversal to: Track the first occurrence when the target appears Keep updating the last occurrence while iterating This keeps the logic simple and easy to reason about. 📊 Performance ✅ All test cases passed ⚡ Correct and clean implementation 💾 Stable memory usage 📚 Key Takeaway This problem helped reinforce an important learning: There are often multiple valid approaches to the same problem: A linear scan → simpler and intuitive A binary search boundary approach → more optimal (O(log n)) Understanding both matters more than jumping directly to the most optimized solution. Today’s focus was on correctness and clarity first — optimization can always follow. 🎯 Day 19 complete. Each problem is improving how I think about trade-offs between readability, correctness, and performance. #Day19 #30DaysOfCode #LeetCode #Java #Algorithms #BinarySearch #ProblemSolving #InterviewPreparation #SoftwareEngineering #CodingJourney #Consistency #TechGrowth
To view or add a comment, sign in
-
-
🚀 Day 11/100 — Efficiency to the Max! Today’s Challenge: Beating 100% of Submissions ⚡ Yesterday was about simplicity; today was about raw speed and optimization. As I move into the second decile of this journey, I’m focusing on not just solving the problem, but mastering the underlying mechanics to write code that runs in 0ms. 💡 The Strategy: Optimization over Iteration To hit that 100% runtime mark on LeetCode, especially in problems involving bit manipulation or array traversal, I focused on: Pruning: Breaking out of loops the micro-second a condition isn't met. Memory Efficiency: Using primitive arrays instead of heavy Collections where possible to reduce overhead. Bitwise Magic: Replacing division or modulo operators with bit shifts and masks to shave off those final milliseconds. 🔧 Deep Dive: The "100% Club" Workflow Analyze the Constraints: If $N$ is small, can I pre-calculate? If $N$ is large, is there a hidden mathematical pattern? Avoid String Concatenation: Switched to StringBuilder or char arrays for problems requiring heavy string manipulation—this is often the "secret sauce" for Java performance. Space-Time Tradeoff: Sometimes using a bit more memory (memoization) is the price of admission for top-tier speed. ✨ Reflection The difference between a solution that "works" and a solution that "beats 100%" is often just 5–10 lines of thoughtful optimization. It’s about understanding how the JVM handles memory and execution under the hood. 11 days in. The logic is getting sharper, and the code is getting leaner. 90 days to go, and I’m just getting started! 🛠️ #Java #DSA #LeetCode #CodingJourney #100DaysOfCode #SoftwareEngineer #InternshipBound #Optimization #CleanCode #Algorithms
To view or add a comment, sign in
-
-
Day 36 :- Binary Search & Range Finding: Find First and Last Position of Element ✅ Today’s DSA session was a great exercise in extending the classic Binary Search to handle multiple occurrences of a target value. I tackled LeetCode 34. Find First and Last Position of Element in Sorted Array, focusing on how to efficiently pinpoint a range within a sorted dataset. The Technical Breakdown: Hybrid Search Strategy: I started with a standard Binary Search to find any instance of the target. This immediately gives us an O(log n) starting point. Linear Expansion: Once the target was found, I used two pointers to expand outward from the meeting point. This identifies the exact boundaries where the target values start and end. Edge Case Handling: The logic naturally handles cases where the target isn't present by returning [-1, -1], and it manages single-element arrays or cases where the target spans the entire array. The Trade-off: While this approach is very intuitive, it can reach O(n) in the worst case (e.g., an array of all identical numbers). It’s a great stepping stone before diving into the pure O(log n) approach of finding the "leftmost" and "rightmost" indices independently! It's a solid reminder that Binary Search isn't just for finding a single value—it's the foundation for navigating any sorted range! 🚀 A huge thanks to my mentor, Anchal Sharma and Ikshit .. for the incredible support and for helping me stay consistent on this journey. Having that accountability makes all the difference! #DSA #Java #100DaysOfCode #BinarySearch #TwoPointers #ProblemSolving #Mentorship #LeetCode #SoftwareEngineering
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
-
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