🚀 Day 28/100 – #100DaysOfCode Today’s problem: Reverse Linked List (LeetCode 206) 💡 What I learned: How to reverse a singly linked list using an iterative approach Managing pointers efficiently (prev, curr, next) Understanding how links change direction step by step 🧠 Key Idea: Instead of creating a new list, we reverse the links in-place: Store next node Reverse current pointer Move forward 📊 Complexity: Time: O(n) Space: O(1) Staying consistent, one problem at a time... #Day28 #100DaysOfCode #LeetCode #DSA #LinkedList #Java #CodingJourney #ProblemSolving #TechSkills
Reversing a Singly Linked List with Iterative Approach
More Relevant Posts
-
Day 31/50 🚀 — Reverse Vowels of a String (LeetCode 345) Today’s problem was a great reminder that sometimes the simplest approaches are the most efficient. 🔹 Used the two-pointer technique 🔹 Focused on in-place swapping 🔹 Optimized for both time (O(n)) and space (O(1)) Key takeaway: Instead of overthinking, break the problem into smaller checks—identify vowels, move pointers smartly, and swap only when needed. Clean and efficient 💡 Happy to see this solution performing well: ⚡ Runtime: 2 ms (faster than 99%+) 📦 Space: Decent optimization #Day31 #LeetCode #DSA #Java #CodingJourney #50DaysOfCode #ProblemSolving #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 Day 29/100 – #100DaysOfCode Today’s problem: Middle of the Linked List (LeetCode 876) 🎯 💡 What I learned: How to find the middle node efficiently using the two-pointer (slow & fast) approach Understanding why the fast pointer moves twice as fast as the slow pointer Handling both odd and even length linked lists Writing optimal code with O(n) time and O(1) space 🧠 Key Idea: Use two pointers: slow → moves 1 step at a time fast → moves 2 steps at a time 👉 When fast reaches the end, slow will be at the middle! 📊 Complexity: Time: O(n) Space: O(1) 📈 One step closer to mastering Linked Lists..... #Day29 #100DaysOfCode #LeetCode #LinkedList #DSA #Java #CodingJourney #ProblemSolving #TechSkills
To view or add a comment, sign in
-
-
Day 2 of #LeetCodeDailyChallenge Showing up again — because consistency builds confidence. Today’s problem: Add Two Numbers 📌 Topic: Linked List ⚡ Difficulty: Medium What I focused on today: Traversing two linked lists together step-by-step Managing carry without breaking the flow Creating a result list dynamically while iterating Handling tricky edge cases (unequal lengths & leftover carry) This problem really helped me understand how small details (like carry) can impact the overall logic. Every day isn’t about solving something big — sometimes it's about understanding something better than yesterday. #DSA #LeetCode #Java #LinkedList #ProblemSolving #Consistency #LearningInPublic
To view or add a comment, sign in
-
🚀 Day 27/100 Days of Code Challenge Today’s problem: Find Peak Element (Leetcode 162) 🔍 What I learned: How to find a peak element efficiently without scanning the entire array Using Binary Search to reduce time complexity from O(n) to O(log n) Understanding how the “slope” of elements helps decide the search direction 🧠 Key Idea: Instead of checking every element, compare the middle element with its neighbor: If nums[mid] < nums[mid + 1] → move right Else → move left ✅ Example: Input: [1, 2, 3, 1] Output: 2 (index of peak element 3) Consistency is key 🔑 — improving problem-solving skills one day at a time! 💪 #Day27 #100DaysOfCode #LeetCode #BinarySearch #DSA #Java #CodingJourney
To view or add a comment, sign in
-
-
Day 78 of #LeetCode 🚀 Solved: Number of Steps to Reduce a Number to Zero Today’s problem was simple but a great reminder of how important basic logic and loops are. 💡 Key Idea: If number is even → divide by 2 If odd → subtract 1 Repeat until it becomes 0 📌 Focus: Strengthening fundamentals Writing clean and efficient logic Consistency > Complexity 💯 Slowly building problem-solving mindset every day. #Day78 #CodingJourney #Java #DSA #LeetCode #Consistency #FutureDeveloper
To view or add a comment, sign in
-
-
Day: 95/365 📌 LeetCode POTD: Minimum Distance Between Three Equal Elements II Medium Key takeaways/Learnings from this problem: 1. This one highlights how tracking indices smartly is more important than checking all triplets brute-force. 2. Using previous occurrences helps you narrow down valid triples quickly instead of re-scanning the array. 3. Big takeaway: problems with “equal elements” often reduce to index management + pattern observation. 4. Also a good reminder that optimizing from O(n³) thinking to near O(n) comes down to storing the right info while iterating. #POTD #365DaysOfCode #DSA #Java #ProblemSolving #LearningInPublic #Consistency 🥷
To view or add a comment, sign in
-
-
Day 42 of consistency 💻🔥 Solved Add Two Numbers using linked lists — a classic problem that really tests understanding of pointers, carry handling, and edge cases. Key takeaways: Handling carry efficiently is crucial Dummy nodes make list problems much cleaner Iterative approach keeps space optimal Not the fastest runtime yet, but improvement is a process — optimizing step by step. Consistency > Perfection. #Day42 #LeetCode #DSA #Java #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
#Day72 Of Problem Solving Solved today’s LeetCode Daily Challenge ✅. Problem: Check if Binary String Has at Most One Segment of Ones Sometimes, the simplest logic gives the best results. Instead of overthinking, I went with a clean approach—just checking if "01" exists in the string. If it does, that means more than one segment of 1’s… and that’s it! ✔️ All test cases passed ⚡ Runtime: 0 ms 📊 Beat 100% in performance This problem was a good reminder that not every solution needs complexity—clarity matters more. Consistency > Complexity 🚀 On to the next challenge! #LeetCode #DailyChallenge #Java #ProblemSolving #CodingJourney #100DaysOfCode #LinkedIn
To view or add a comment, sign in
-
-
🚀 Day 64/100 Today’s problem: Find all strings that are substrings of another word 🧠 What I learned: - How to compare strings using nested loops - Using ".contains()" to check substrings efficiently - Importance of breaking early to optimize performance - Strengthening problem-solving with brute-force approach 💡 Key Insight: Sometimes simple solutions (O(n²)) are enough when constraints are small. No need to overcomplicate! 🔁 Consistency > Perfection #Day64 #DSA #Java #CodingJourney #Consistency #KeepLearning #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 54 of my #100DaysOfCode Journey Today, I solved LeetCode – Sort Array By Parity II Problem Insight: Rearrange the array such that even-indexed positions have even numbers and odd-indexed positions have odd numbers. Approach: • Created a new result array of same size • Used two pointers: evenplace = 0 and oddplace = 1 • Traversed the array once • Placed even numbers at even indices and odd numbers at odd indices • Incremented pointers by 2 to maintain correct positions Time Complexity: O(n) | Space Complexity: O(n) Key Takeaway: Using two pointers for index placement makes the solution clean, efficient, and avoids unnecessary swaps. #DSA #Java #LeetCode #100DaysOfCode #CodingJourney
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