🚀 Day 15/100 — Coding Challenge Solved Search in Linked List The task is straightforward: 1) Traverse the linked list 2) Check each node’s value 3) Return true if found, else false 💡 Approach: 1) Start from head 2) Move node by node using next 3) Stop when element is found or list ends 🧠 Time Complexity: O(n) 💾 Space Complexity: O(1) 💡 What I realized: Unlike arrays, linked lists don’t allow direct access. You have to traverse sequentially, which makes understanding traversal very important. Focusing on strengthening fundamentals. #LeetCode #DSA #100DaysOfCode #Cpp #LinkedList #CodingJourney
Solving Search in Linked List Challenge
More Relevant Posts
-
🚀 Day 33 | 100 Days of Coding Challenge #DrGViswanathanChallenge 📘 Problem Solved: Valid Parentheses (LeetCode) 🔧 Approach Used (Stack): • Traversed the string character by character • Pushed all opening brackets onto the stack • For every closing bracket, checked the top of the stack • Ensured correct matching and order 📌 Key Idea: Last opened bracket should be the first to close → perfect use of LIFO (Stack) ⏳ Complexity: Time: O(n) Space: O(n) 🧠 Key Learning: Stacks are ideal for problems involving balanced expressions and order validation. 📂 Topics Covered: Stack, Strings, Expression Validation #100DaysOfCode #DSA #CPP #LeetCode #CodingJourney #CompetitiveProgramming
To view or add a comment, sign in
-
-
🚀 Day 45 | 100 Days of Coding Challenge #DrGViswanathanChallenge 📘 Problem Solved: Stock Span Problem (LeetCode) 🔧 Approach Used (Monotonic Stack): • Used a stack to store pairs of {price, span} • For each new price, popped all smaller or equal prices from stack • Accumulated their span to get the current span • Pushed the current price with its computed span 📌 Key Idea: Maintain a decreasing stack so we can efficiently skip previous smaller elements and calculate span in one go. ⏳ Complexity: Time: O(n) amortized Space: O(n) 🧠 Key Learning: Monotonic stack helps optimize problems involving “nearest greater/smaller elements” and avoids redundant comparisons. 💡 Optimization Insight: Instead of checking all previous elements (O(n²)), stack helps compress multiple comparisons into one step. 📂 Topics Covered: Stack, Monotonic Stack, Design #100DaysOfCode #DSA #CPP #LeetCode #CodingJourney #CompetitiveProgramming
To view or add a comment, sign in
-
-
Day 4/100 of my LeetCode Journey Back on track after a short break, and today’s problem was “Kth Smallest Element in a Sorted Matrix.” At first, I didn’t approach it correctly. I was thinking in terms of simple indexing, but this problem required a different perspective. I learned how a min heap can be used to efficiently track the smallest elements across multiple rows. Instead of checking the entire matrix, the idea is to always pick the smallest available element and move forward from there. What I noticed today is that my logic is improving, but I still need to be careful with implementation. Small syntax and indexing mistakes can break the whole solution even when the approach is right. Takeaway: Understanding the approach is important, but writing clean and correct code is equally important. Making steady progress, one problem at a time. Question: Do you also find implementation harder than understanding the logic? #Day4 #LeetCode #DSA #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
🚀 Day 34 | 100 Days of Coding Challenge #DrGViswanathanChallenge 📘 Problem Solved: Min Stack (LeetCode) 🔧 Approach Used (Stack with Pair): • Stored elements as (value, current minimum) in the stack • On each push, updated the minimum using previous minimum • Allowed retrieving minimum in O(1) without extra traversal 📌 Key Idea: Track the minimum at every step so it’s always available at the top. ⏳ Complexity: Push: O(1) Pop: O(1) Top: O(1) GetMin: O(1) Space: O(n) 🧠 Key Learning: Augmenting data structures with extra information can optimize operations significantly. 📂 Topics Covered: Stack, Design, Optimization #100DaysOfCode #DSA #CPP #LeetCode #CodingJourney #CompetitiveProgramming
To view or add a comment, sign in
-
-
🚀 Day 41 | 100 Days of Coding Challenge #DrGViswanathanChallenge 📘 Problem Solved: Remove K Digits (LeetCode) 🔧 Approach Used (Monotonic Stack - Greedy): • Used a stack to maintain digits in increasing order • If current digit is smaller than top → pop larger digits (to minimize number) • Continued until k digits are removed • If still k remains, removed from end • Built final number and removed leading zeros 📌 Key Idea: To get the smallest number, always try to remove larger digits that come before smaller digits. ⏳ Complexity: Time: O(n) Space: O(n) 🧠 Key Learning: Greedy + stack works perfectly when we need to build the smallest/largest sequence by removing elements. 💡 Optimization Insight: Monotonic stack helps make optimal decisions locally, leading to a globally optimal solution. 📂 Topics Covered: Stack, Greedy, Strings 📊 Example: Input: "1432219", k = 3 Output: "1219" 🔥 Another powerful use of monotonic stack in optimization problems! #100DaysOfCode #DSA #CPP #LeetCode #CodingJourney #CompetitiveProgramming
To view or add a comment, sign in
-
-
100 LeetCode problems solved ! and honestly, it's taught me more about thinking than coding. When I started, I used to jump straight to the solution. Now I've learned to slow down — understand the problem, think brute force first, then optimize. Patterns I've been focusing on: → Sliding Window → Two Pointers → Stack & Queue → Kadane's Algorithm → Prefix Sum → Merge Intervals → Linked List The biggest shift wasn't in the number of problems solved — it was learning to recognize WHY a particular approach works, not just HOW. Still a long way to go. But consistency is starting to show results. 100 done. More to come. 🎯 #DSA #LeetCode #CodingJourney #SoftwareEngineering #100Problems
To view or add a comment, sign in
-
-
Day 28 of #100DaysOfCode 💻 Today’s focus: Subsets II (LeetCode 90) Building on yesterday’s Subset Sum (Problem 1), today I explored how the same recursion pattern works when duplicates are involved. 📌 What I focused on: At each step → either pick the element or skip it (same as Subset 1) Sorting the array to handle duplicates Skipping repeated elements at the same recursion level 💡 Realization: Subset II is not a completely new problem—it’s an extension of Subset 1 with an extra constraint. Understanding the base pattern made it much easier to adapt and solve this one. Felt good to see how concepts connect step by step. Still getting more comfortable with recursion and backtracking 🚀 #LeetCode #DSA #Recursion #Backtracking #CodingJourney
To view or add a comment, sign in
-
-
Day 50 of my #50DaysOfCode challenge is done ✅🎉 📌 Problem Solved Reorder Linked List We were given a linked list. Task was to reorder it like: L0 → Ln → L1 → Ln-1 → L2 → Ln-2 … Not just reverse. Rearrange in a specific pattern. 💻 Approach 🔹️Find the middle of the linked list. 🔹️Reverse the second half. 🔹️Merge both halves alternately. Step by step: 🔹️Use slow and fast pointers to find middle 🔹️Reverse second half of list 🔹️Merge nodes one by one Careful pointer handling needed. 📊 Complexity Analysis Time Complexity: O(n) Space Complexity: O(1) 📚 What I learned today: ▫️Linked list problems often combine multiple steps. ▫️Finding middle + reversing + merging is a common pattern. ▫️Pointer manipulation needs careful attention. ▫️Breaking problem into parts makes it manageable. 🎯 50 Days Completed Started with basic patterns. Reached linked lists, stacks, recursion, sliding window. Some days were easy. Some were confusing. But I showed up every day. That’s the biggest win. This challenge was not just about coding. It was about consistency and discipline. #50DaysOfCode #CodingChallenge #Consistency #LearningInPublic
To view or add a comment, sign in
-
Most people understand cycle detection… but get stuck when asked to find where the cycle starts. 🚀 Day 19/100 — LeetCode Challenge Solved Linked List Cycle II 💡 Step 1: Detect cycle -Use slow & fast pointers -If they meet → cycle exists 💡 Step 2: Find starting node -Move fast back to head -Move both one step at a time -Where they meet again → start of cycle 👉 This part is pure intuition + math 🧠 Time Complexity: O(n) 💾 Space Complexity: O(1) 💡 What I learned: Detecting a cycle is easy. Finding its starting point is where real understanding begins. This is one of those problems where you either memorize… or truly understand. Have you ever understood why this works? #LeetCode #DSA #100DaysOfCode #Cpp #LinkedList #TwoPointers #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 4 of My LeetCode Journey Solved today’s problem: Two Edit Words ✅ Really enjoyed working on this one! 🔹 Problem Statement: Return all words in the dictionary that are exactly two edits away from any of the given queries (edit = insert, delete, or replace a character). 🔹 Approach: • For each query, compared it with every word in the dictionary • Counted character differences • If differences == 2 → valid word • Optimized by breaking early if differences exceed 2 🔹 Complexity: • Time Complexity: O(Q × N × L) • Space Complexity: O(1) 🧠 Key Learning: Handling string problems efficiently by avoiding unnecessary comparisons can significantly improve performance. 📊 Today’s Stats: ✅ Runtime: 0 ms (Beats 100%) ✅ Memory: 12.44 MB Consistency is the real game changer 💪 #LeetCode #DSA #CodingJourney #ProblemSolving #Consistency
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