🚀 Day 4/100 – #100DaysOfDSA Consistency is getting stronger. 💪 Day 4 done. No zero days. Today’s problem: Merge In Between Linked Lists (LeetCode 1669 – Medium) At first, it looked simple. But Linked Lists always test one thing seriously — 👉 Pointer control. 🧠 What This Problem Required: Finding the node just before position a Finding the node just after position b Carefully reconnecting pointers Traversing list2 till the end Attaching everything without breaking the chain One small mistake in pointer movement = runtime error. 💥 💡 What I Learned: ✔ Think step-by-step before coding ✔ Dry run pointer problems on paper ✔ Linked List problems improve logical clarity ✔ Clean reconnection > complicated logic This journey is not about solving problems. It’s about becoming better at thinking. 4 Days. 4 Problems. 0 Excuses. Day 5 loading… 🚀 #100DaysOfDSA #LeetCode #LinkedList #ProblemSolving #CodingJourney #Consistency #BTech
Day 4 of 100: Merging Linked Lists with LeetCode 1669
More Relevant Posts
-
🚀 Day 5/100 – #100DaysOfDSA Consistency is becoming a habit now. 💪 Day 5 completed. No zero days. Today’s problem: Merge In Between Linked Lists (LeetCode 1669 – Medium) At first glance, it looked straightforward. But Linked Lists always test one thing seriously — 👉 Pointer control. 🧠 What This Problem Required: • Finding the node just before position a • Finding the node just after position b • Carefully reconnecting pointers • Traversing list2 till the end • Attaching everything without breaking the chain One small mistake in pointer movement = runtime error. 💥 That’s the beauty (and danger) of Linked Lists. 💡 What I Learned: ✔ Think step-by-step before coding ✔ Dry run pointer problems on paper ✔ Linked List problems sharpen logical clarity ✔ Clean reconnection > complicated logic This journey is not just about solving problems. It’s about becoming better at thinking. 5 Days. 5 Problems. 0 Excuses. Day 6 loading… 🚀 #100DaysOfDSA #LeetCode #LinkedList #ProblemSolving #CodingJourney #Consistency #BTech
To view or add a comment, sign in
-
-
#100DaysOfLeetCodeChallenge Day 29/100-LeetCode Challenge 24. Swap Nodes in Pairs. 🔹 Problem: Given a linked list, swap every two adjacent nodes and return its head. ❗ Important: You must swap nodes, not just values. 💡 My Approach (Iterative – No Recursion) Instead of recursion, I used: ✅ A dummy node ✅ Two pointers ✅ Careful pointer adjustment This makes the solution: ✔ Efficient ✔ Easy to debug ✔ No extra recursive stack space 🔎 Key Idea If we have: 1 → 2 → 3 → 4 After swapping: 2 → 1 → 4 → 3 We move two nodes at a time and adjust pointers carefully. ⚡ Time Complexity: O(n) ⚡ Space Complexity: O(1) Consistency > Motivation 💪 One problem at a time. #LeetCode #DSA #LinkedList #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 11 Today I solved “Minimum Distance to the Target Element” on LeetCode. The problem is about finding the minimum distance between a given index and a target value in an array. At first, it feels like a basic iteration problem — just loop through the array and check where the target appears. But what I focused on was the thinking pattern behind it: 👉 Instead of storing all positions of the target, we can continuously track the minimum absolute distance while iterating. For every occurrence of the target: Compute |i - start| Update the minimum distance This keeps the solution: Simple Efficient (O(n)) Memory optimized (no extra storage needed) 💡 Key takeaway: Even in straightforward problems, choosing to track only what’s necessary can make your solution cleaner and more efficient. Small improvements in thinking lead to better coding habits over time. #LeetCode #DSA #ProblemSolving #LearnInPublic
To view or add a comment, sign in
-
-
#100DaysOfLeetCodeChallenge Day 31/100 3065-MINIMUM OPERATIONS TO EXCEED THRESHOLD VALUE. 🔢 Minimum Operations Problem 🔹 Task: Given an array nums and an integer k, find the minimum number of operations needed based on the condition. 💡 My Approach I used a simple and clean logic: 1)Traverse the array 2)Check if nums[i] < k 3)Increment counter 4)Return final count 5)No extra space, no complex logic — just clear iteration. ⏱ Time Complexity: O(n) 📦 Space Complexity: O(1) #LeetCode #DSA #Cpp #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 61 of LeetCode Problem Solving Journey — 100 Days LeetCode Challenge Today, I solved LeetCode #189 — Rotate Array using C++, under the guidance of Trainer NEKAL SINGH SALARIA Singh at REGex Software Services. 🔍 Problem Summary: Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. 🧠 Approach Used (Reversal Algorithm): I used the three-step reverse technique: Normalize rotation using k = k % n to handle large k Reverse first part → [0 → n-k-1] Reverse second part → [n-k → n-1] Reverse entire array This approach rotates the array in-place without extra space. 📚 Key Learnings of the Day ✔ Modulo helps handle rotation values larger than array size ✔ Reversal logic can simulate rotation efficiently ✔ In-place algorithms save memory ✔ Breaking problems into steps simplifies logic ⏱ Complexity • Time Complexity: O(n) • Space Complexity: O(1) 💡 Optimization Insight: This is the optimal approach because it performs rotation in linear time and constant space. Alternative methods like using extra arrays increase space complexity. Consistency builds mastery — see you on Day 62 🚀 #Day61 #100DaysLeetCodeChallenge #LeetCode #RegexSoftwareServices #NekalSingh #ProblemSolving #DSA #CPlusPlus #CodingChallenge #ProgrammingJourney #Arrays #KeepGrowing
To view or add a comment, sign in
-
-
Day 57/100 – #100DaysOfLeetCode 🚀 🧩 Problem: LeetCode 260 – Single Number III (Medium) 🧠 Approach: Since every element appears twice except two numbers, return the numbers whose frequency is 1. 💻 Solution: class Solution: def singleNumber(self, nums: List[int]) -> List[int]: if len(nums)==2: return nums ele = [] d = {} for i in nums: d[i] = d.get(i,0)+1 for i in d: if d[i]==1: ele.append(i) return ele ⏱ Time | Space: O(n) | O(n) 📌 Key Takeaway: Frequency counting is a straightforward way to identify unique elements in an array. #leetcode #dsa #development #problemSolving #CodingChallenge
To view or add a comment, sign in
-
-
Linked Lists always test one thing seriously — pointer control. Today’s problem reminded me of that again. 🚀 Day 11/100 – #100DaysOfDSA 🧩 Problem: Swapping Nodes in a Linked List (LeetCode 1721) 🧠 Problem Understanding Given a linked list and an integer k, we need to swap the value of the k-th node from the beginning and the k-th node from the end. Example: 1 → 2 → 3 → 4 → 5 k = 2 After swapping: 1 → 4 → 3 → 2 → 5 ⚡ Key Idea Instead of calculating the length and traversing twice, this can be solved efficiently using the two-pointer technique. Steps I used: • Traverse to reach the k-th node from the start • Start another pointer from the head • Move both pointers together until the end • The second pointer reaches the k-th node from the end • Finally, swap their values 💡 Concepts Practiced • Linked List traversal • Two-pointer technique • Pointer control and node tracking 📈 Reflection Problems like these remind me that DSA is less about writing long code and more about thinking clearly about the structure. Small problems. Stronger fundamentals. Day 11 done. On to Day 12. 🚀 ❓ Question for fellow developers: Have you solved this problem using a different approach? #100DaysOfCode #DSA #LeetCode #Cpp #LinkedList #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Day 26 of my #50DaysOfCode challenge is done ✅ 📌 Problem Solved Convert Binary to Octal We were given a binary number. Task was to convert it into octal. Octal uses base 8. And 1 octal digit = 3 binary bits. So the key idea is simple. Group the binary digits in sets of three. Example: Binary → 101110 Group into 3 bits: 101 | 110 Convert each group: 101 → 5 110 → 6 Octal = 56 💻 Approach 🔹️Take the binary string. 🔹️Check its length. 🔹️If length is not multiple of 3, add leading zeros. 🔹️Traverse the string in groups of 3 bits. 🔹️Convert each group using positional values (4, 2, 1). 🔹️Append the result to the final answer. Simple grouping logic. 📊 Complexity Analysis Time Complexity: O(n) Each bit is processed once. Space Complexity: O(n) Output string depends on input size. 📚 What I learned today: ▫️Binary can be converted easily using bit grouping. ▫️3 binary bits directly map to 1 octal digit. ▫️Padding zeros does not change the value. ▫️Understanding number system relationships simplifies conversions. Day 26 completed. Number system concepts getting clearer 🚀 #50DaysOfCode #CodingChallenge #Consistency #LearningInPublic
To view or add a comment, sign in
-
Day 21 of my #50DaysOfCode challenge is done ✅ 📌 Problem Solved Replace all 0’s with 1 in a given integer We were given an integer. Task was simple. Replace every 0 with 1. At first it looked very basic. But there were two ways to approach it. Let’s understand it simply. ◾️Imagine a number written on paper. ◾️Whenever you see a 0, you overwrite it with 1. ◾️All other digits remain the same. That’s the idea. --- 💻 Approach 1 (Using String) 🔹️Convert the integer to a string. 🔹️Traverse each character. 🔹️If character is '0', replace it with '1'. 🔹️Convert the string back to integer. Very simple. Easy to implement. 💻 Approach 2 (Using Arithmetic) This avoids string conversion. 🔹️Extract digits using n % 10. 🔹️If digit is 0, change it to 1. 🔹️Build a new number using multiplication and addition. 🔹️Reverse it again to maintain correct order. More number manipulation involved. 📊 Complexity Analysis Time Complexity: O(D) Where D is number of digits. Space Complexity: O(1) Only few variables used. 📚 What I learned today: ▫️Simple problems can have multiple approaches. ▫️String operations make digit problems easier. ▫️Arithmetic manipulation gives more control over digits. ▫️Understanding both approaches improves problem solving. Day 21 completed. Learning small tricks every day 🚀 #50DaysOfCode #CodingChallenge #Consistency #LearningInPublic
To view or add a comment, sign in
-
Day 58/100 – #100DaysOfLeetCode 🚀 🧩 Problem: LeetCode 696 – Count Binary Substrings (Medium) 🧠 Approach: For each transition, add min(previous_group_length, current_group_length) to the result. This ensures equal numbers of consecutive 0s and 1s in each valid substring. 💻 Solution: class Solution: def countBinarySubstrings(self, s: str) -> int: prev = 0 curr = 1 result = 0 for i in range(1, len(s)): if s[i] == s[i-1]: curr += 1 else: result += min(prev, curr) prev = curr curr = 1 result += min(prev, curr) return result ⏱ Time | Space: O(n) | O(1) 📌 Key Takeaway: Tracking group lengths instead of generating substrings makes the solution efficient and avoids unnecessary extra space. #leetcode #dsa #development #problemSolving #CodingChallenge
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