🚀 Day 15/100 – DSA Journey Today was all about restructuring Linked Lists efficiently and thinking in terms of pointer movement 🔗 🔹 Problems Solved: 1. Rotate List 2. Merge Two Sorted Lists 💡 Key Learnings: 👉 Problem 1: Rotate List First, calculate the length of the list Optimize rotations using: k % length Use two pointers (fast & slow) to find new head 👉 Key Insight: Instead of rotating one by one, directly find the breaking point ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Merge Two Sorted Lists Used dummy node technique for clean implementation Compare nodes and attach smaller one 👉 Key Insight: Avoid extra space by reusing existing nodes ✅ O(n + m) Time ✅ O(1) Space 🔥 What I learned today: Most Linked List problems become easier when you: - Use dummy nodes - Think in terms of breaking & reconnecting links Also realized how small optimizations (like k % n) can save a lot of work 👀 Day 15 done ✅ Staying consistent! #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
Day 15: Linked List Optimizations with Dummy Nodes and Pointer Movement
More Relevant Posts
-
🚀 Day 15/100 – DSA Journey Today was all about restructuring Linked Lists efficiently and thinking in terms of pointer movement 🔗 🔹 Problems Solved: 1. Rotate List 2. Merge Two Sorted Lists 💡 Key Learnings: 👉 Problem 1: Rotate List First, calculate the length of the list Optimize rotations using: k % length Use two pointers (fast & slow) to find new head 👉 Key Insight: Instead of rotating one by one, directly find the breaking point ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Merge Two Sorted Lists Used dummy node technique for clean implementation Compare nodes and attach smaller one 👉 Key Insight: Avoid extra space by reusing existing nodes ✅ O(n + m) Time ✅ O(1) Space 🔥 What I learned today: Most Linked List problems become easier when you: - Use dummy nodes - Think in terms of breaking & reconnecting links Also realized how small optimizations (like k % n) can save a lot of work 👀 Day 15 done ✅ Staying consistent! #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #frontenddeveloper #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
🚀 Day 16/100 – DSA Journey Today’s problem was a great exercise in pointer manipulation and recursion thinking 🔗 🔹 Problem Solved: 1. Swap Nodes in Pairs 💡 Key Learnings: 👉 Approach 1: Iterative (Pointer Manipulation) Use a dummy node to simplify edge cases Swap nodes in pairs by adjusting pointers Move pointers step by step 👉 Key Insight: Careful pointer updates are crucial — one wrong link breaks the list 👉 Approach 2: Recursive Swap first two nodes Recursively solve for the rest of the list 👉 Core Idea: Break problem into smaller subproblems ✅ O(n) Time ✅ O(1) Space (Iterative) ⚠️ Recursive uses call stack → O(n) space 🔥 What I learned today: Same problem, two different mindsets: Iterative → control everything step-by-step Recursive → trust the function to handle smaller parts Both are powerful — knowing when to use which is key 👀 Day 16 done ✅ Consistency continues! 💬 Quick question: Which approach do you prefer for Linked Lists — Iterative or Recursive? #100DaysOfDSA #buildinpublic #codinginpublic #leetcodejourney #softwareengineerlife #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
🚀 Day 16/100 – DSA Journey Today’s problem was a great exercise in pointer manipulation and recursion thinking 🔗 🔹 Problem Solved: 1. Swap Nodes in Pairs 💡 Key Learnings: 👉 Approach 1: Iterative (Pointer Manipulation) Use a dummy node to simplify edge cases Swap nodes in pairs by adjusting pointers Move pointers step by step 👉 Key Insight: Careful pointer updates are crucial — one wrong link breaks the list 👉 Approach 2: Recursive Swap first two nodes Recursively solve for the rest of the list 👉 Core Idea: Break problem into smaller subproblems ✅ O(n) Time ✅ O(1) Space (Iterative) ⚠️ Recursive uses call stack → O(n) space 🔥 What I learned today: Same problem, two different mindsets: Iterative → control everything step-by-step Recursive → trust the function to handle smaller parts Both are powerful — knowing when to use which is key 👀 Day 16 done ✅ Consistency continues! 💬 Quick question: Which approach do you prefer for Linked Lists — Iterative or Recursive? #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #frontenddeveloper #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
🚀 Day 36 of solving DSA problems ✅ Problem Solved: Combination Sum Today I solved a powerful backtracking problem where the goal is to find all unique combinations of numbers that sum up to a target. 💡 What I learned: Backtracking is all about decision making with recursion The same element can be used multiple times At every step, we have two choices: Include the current element Skip it and move to the next ⚡ Key Insight: 👉 If we call recursion with the same index, we can reuse the same element multiple times 👉 If we move to the next index, we explore new elements 🧠 Approach: Use a recursive backtracking function Base cases: target == 0 → valid combination found target < 0 → stop (invalid path) At each step: pick the element backtrack skip and move forward ⏱ Complexity: Time: Exponential (Backtracking) Space: O(target) 💻 Result: ✅ Accepted ⚡ Runtime: 1 ms 🔥 Beats: 100% Consistency is the real power. Step by step, improving every day 💪 #Day36 #DSA #Backtracking #LeetCode #CodingJourney #CSharp #ProblemSolving #DeveloperJourney 🚀
To view or add a comment, sign in
-
-
Day 32 of my DSA Journey 🚀 Solved: Subsets (Power Set) This is a classic problem that builds the foundation of backtracking. Core Idea: At every index, we have two choices: • Include the current element • Exclude the current element This “pick / not pick” pattern generates all possible subsets. Time Complexity: O(2ⁿ) → Each element has 2 choices Space Complexity: O(N) (recursion stack) + O(2ⁿ * N) to store all subsets What this problem teaches: - The most fundamental backtracking pattern - How decision trees work (binary choices at each step) - Base for advanced problems like combinations, subsequences, etc. If this doesn’t feel natural yet, you’ll struggle with most backtracking problems ahead. #Day32 #DSA #Backtracking #Recursion #LeetCode #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 17/100 – DSA Journey Taking a slight shift from Linked Lists to string & array-based problems today ✨ 🔹 Problems Solved: 1. Find Words Containing Character 2. Length of Last Word 💡 Key Learnings: 👉 Problem 1: Find Words Containing Character Iterate through the array of words Check if each word includes the given character Store indices of matching words 👉 Key Insight: Simple traversal + condition check can solve efficiently ✅ O(n * m) Time (n = words, m = avg word length) ✅ O(k) Space (for result) 👉 Problem 2: Length of Last Word Traverse string from the end Skip trailing spaces Count characters until next space 👉 Key Insight: Reverse traversal avoids unnecessary splits ✅ O(n) Time ✅ O(1) Space 🔥 What I learned today: Not every problem needs complex data structures — sometimes clean string handling and traversal logic is enough. Switching between topics is helping me think more flexibly 🧠 Day 17 done ✅ Staying consistent! 💬 Quick question: Do you prefer solving string problems or linked list problems? #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #frontenddeveloper #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
🚀 Day 17/100 – DSA Journey Taking a slight shift from Linked Lists to string & array-based problems today ✨ 🔹 Problems Solved: 1. Find Words Containing Character 2. Length of Last Word 💡 Key Learnings: 👉 Problem 1: Find Words Containing Character Iterate through the array of words Check if each word includes the given character Store indices of matching words 👉 Key Insight: Simple traversal + condition check can solve efficiently ✅ O(n * m) Time (n = words, m = avg word length) ✅ O(k) Space (for result) 👉 Problem 2: Length of Last Word Traverse string from the end Skip trailing spaces Count characters until next space 👉 Key Insight: Reverse traversal avoids unnecessary splits ✅ O(n) Time ✅ O(1) Space 🔥 What I learned today: Not every problem needs complex data structures — sometimes clean string handling and traversal logic is enough. Switching between topics is helping me think more flexibly 🧠 Day 17 done ✅ Staying consistent! 💬 Quick question: Do you prefer solving string problems or linked list problems? #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
🚀 Day 19/100 – DSA Journey Today’s focus was on string manipulation and pattern-based thinking 🔤 These problems looked simple but required careful handling of conditions 👀 🔹 Problems Solved: 1. Split a String in Balanced Strings 2. Reverse String II 💡 Key Learnings: 👉 Problem 1: Split Balanced Strings Traverse string and keep a counter Increment for 'L', decrement for 'R' (or vice versa) Whenever count becomes 0 → one balanced substring found 👉 Key Insight: Balance tracking helps split efficiently ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Reverse String II Process string in chunks of size 2k Reverse first k characters, leave next k as it is 👉 Key Insight: Careful boundary handling is crucial (edge cases matter!) ✅ O(n) Time ✅ O(1) Space (in-place logic conceptually) 🔥 What I learned today: Many string problems are about identifying the right pattern (counting / chunking) rather than complex logic. Small mistakes in conditions can break the entire solution — attention to detail is everything 👀 Day 19 done ✅ Consistency continues! 💬 Quick question: Which do you find trickier — handling edge cases or finding the right pattern? #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #frontenddeveloper #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
🚀 Day 21/100 – DSA Journey Today’s problems were all about string comparison and pattern matching 🔤 At first they looked straightforward… but handling all cases cleanly was the real challenge 👀 🔹 Problems Solved: 1. Valid Anagram 2. Longest Common Prefix 💡 Key Learnings: 👉 Problem 1: Valid Anagram Compare character frequencies of both strings If every character count matches → strings are anagrams 👉 Key Insight: Frequency counting using Map/Object makes comparison efficient ✅ O(n) Time ✅ O(1) Space (fixed alphabet size) 👉 Problem 2: Longest Common Prefix Start with the first word as prefix Compare it with remaining strings Reduce prefix until all strings match 👉 Key Insight: Gradually shrinking the prefix is simpler than generating all prefixes ✅ O(n * m) Time (m = prefix length) ✅ O(1) Extra Space 🔥 What I learned today: String problems are less about complicated algorithms and more about: choosing the right approach handling edge cases carefully writing clean logic Small optimizations and cleaner thinking are becoming more natural now ⚡ Day 21 done ✅ Still showing up every day! 💬 Quick question: Which do you prefer solving more: 🔹 String problems 🔹 Linked List problems 🔹 Array problems #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #frontenddeveloper #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
🚀 Day 19/100 – DSA Journey Today’s focus was on string manipulation and pattern-based thinking 🔤 These problems looked simple but required careful handling of conditions 👀 🔹 Problems Solved: 1. Split a String in Balanced Strings 2. Reverse String II 💡 Key Learnings: 👉 Problem 1: Split Balanced Strings Traverse string and keep a counter Increment for 'L', decrement for 'R' (or vice versa) Whenever count becomes 0 → one balanced substring found 👉 Key Insight: Balance tracking helps split efficiently ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Reverse String II Process string in chunks of size 2k Reverse first k characters, leave next k as it is 👉 Key Insight: Careful boundary handling is crucial (edge cases matter!) ✅ O(n) Time ✅ O(1) Space (in-place logic conceptually) 🔥 What I learned today: Many string problems are about identifying the right pattern (counting / chunking) rather than complex logic. Small mistakes in conditions can break the entire solution — attention to detail is everything 👀 Day 19 done ✅ Consistency continues! 💬 Quick question: Which do you find trickier — handling edge cases or finding the right pattern? #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
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