🚀 Day 27/60 — LeetCode Discipline Problem Solved: Length of Last Word Difficulty: Easy Today’s problem looked simple, yet it emphasized a subtle but important skill — handling edge cases cleanly. The goal was to find the length of the last word in a string, ignoring any trailing spaces. Instead of splitting the string or using extra space, the solution efficiently traverses from the end, skipping unnecessary characters and counting only what truly matters. It’s a reminder that strong coding is not always about complexity — sometimes, it’s about precision and clarity in small details. 💡 Focus Areas: • Practiced string traversal from end • Improved handling of trailing spaces • Reinforced clean and efficient logic • Avoided unnecessary extra space usage • Strengthened edge-case thinking ⚡ Performance Highlight: Achieved 0 ms runtime (100% performance). Small problems, when approached with discipline, sharpen the instincts that solve big ones. #LeetCode #60DaysOfCode #100DaysOfCode #DSA #Strings #Algorithms #ProblemSolving #CodingJourney #SoftwareEngineering #Java #Developers #Consistency #TechJourney #LearnToCode
LeetCode Discipline: Last Word Length Challenge
More Relevant Posts
-
🚀 Day 29/60 — LeetCode Discipline Problem Solved: Longest Common Prefix Difficulty: Easy Today’s problem focused on identifying the longest common starting pattern across multiple strings — a classic exercise in string comparison and iteration. The approach involved checking characters position by position across all strings until a mismatch is found. This reinforces how simple iterative logic can elegantly solve problems involving multiple inputs. It’s a reminder that sometimes, clarity in approach matters more than complexity in code. 💡 Focus Areas: • Strengthened string traversal techniques • Practiced comparing multiple inputs efficiently • Improved understanding of edge cases (empty strings, mismatch handling) • Reinforced early stopping conditions for optimization • Focused on clean and readable logic ⚡ Performance Highlight: Achieved efficient runtime with minimal overhead. Finding common ground across multiple inputs is not just a coding skill — it’s a pattern recognition mindset. #LeetCode #60DaysOfCode #100DaysOfCode #DSA #Strings #Algorithms #ProblemSolving #CodingJourney #SoftwareEngineering #Java #Developers #Consistency #TechGrowth #LearnToCode
To view or add a comment, sign in
-
-
Day 78 - LeetCode Journey Solved LeetCode 142: Linked List Cycle II (Medium) today — a powerful extension of the cycle detection problem. Earlier, we learned how to detect if a cycle exists. Now the challenge is to find the exact node where the cycle begins. 💡 Core Idea (Floyd’s Algorithm Extended): 1) Use slow & fast pointers to detect a cycle 2) Once they meet, reset one pointer to the head 3) Move both pointers one step at a time 4) The point where they meet again = start of the cycle 🤯 Why it works? Because of the mathematical relationship between distances traveled inside the cycle — both pointers align perfectly at the cycle entry point. ⚡ Key Learning Points: • Advanced use of two-pointer technique • Understanding the mathematics behind cycle detection • Solving without modifying the list • Maintaining O(n) time and O(1) space This is not just coding — this is algorithmic thinking at a deeper level. Also, this pattern connects with: -> Find duplicate number (cycle in array) -> Happy Number problem -> Loop detection in graphs ✅ Stronger conceptual clarity ✅ Better problem-solving depth ✅ Confidence with tricky pointer problems From detecting a cycle to pinpointing its start — that’s real progress 🚀 #LeetCode #DSA #Java #LinkedList #TwoPointers #Algorithms #ProblemSolving #CodingJourney #Consistency #100DaysOfCode #InterviewPreparation #DeveloperGrowth #KeepCoding
To view or add a comment, sign in
-
-
Day 80 - LeetCode Journey 🚀 Solved LeetCode 876: Middle of the Linked List (Easy) — a classic problem that introduces one of the most powerful patterns in linked lists. At first, finding the middle seems straightforward. But doing it efficiently in a single pass is where the real insight comes in. 💡 Core Idea (Slow & Fast Pointer Technique): Initialize two pointers: slow and fast Move slow by 1 step and fast by 2 steps When fast reaches the end, slow will be at the middle If there are two middle nodes, this approach naturally returns the second one. 🤯 Why it works? Because the fast pointer covers double the distance of the slow pointer, so when it finishes traversing the list, the slow pointer is exactly halfway. ⚡ Key Learning Points: • Efficient single-pass traversal • Mastering the slow-fast pointer pattern • Handling even and odd length lists • Achieving O(n) time and O(1) space • Building intuition for pointer-based problems This is a foundational pattern used in many advanced problems. Also, this pattern connects with: Linked List Cycle detection Palindrome Linked List Reorder List Finding intersection of two linked lists ✅ Stronger grasp of two-pointer technique ✅ Better problem-solving efficiency ✅ Cleaner and optimized linked list logic Simple problem, powerful pattern — this is how concepts build up 🚀 #LeetCode #DSA #Java #LinkedList #TwoPointers #Algorithms #ProblemSolving #CodingJourney #Consistency #100DaysOfCode #InterviewPreparation #DeveloperGrowth #KeepCoding
To view or add a comment, sign in
-
-
Just solved LeetCode 876 — Middle of the Linked List 🎯 Simple problem? Maybe. But it’s a perfect example of how clean logic beats brute force. Instead of counting nodes, I used the fast & slow pointer approach — where one pointer moves twice as fast as the other. When the fast pointer reaches the end, the slow pointer is right at the middle. Elegant and efficient! 💡 Key Learnings: ✔️ Simplifying problems with smart pointer techniques ✔️ Writing optimal solutions with O(n) time and O(1) space ✔️ Improving code readability and logic clarity ⚡ Why it matters: These patterns show up again and again in coding interviews and real-world problem solving. Mastering them builds strong fundamentals. Small wins like this build big confidence over time 📈 What’s your go-to strategy for linked list problems? Let’s discuss 👇 #LeetCode #DSA #Coding #ProblemSolving #LinkedList #TechInterview #SoftwareEngineering #LearnInPublic #Consistency #100DaysOfCode
To view or add a comment, sign in
-
-
Day 51 of My 90-Day Coding Challenge Today’s focus was on recursion, and honestly — it’s not as simple as it looks. I solved Letter Combinations of a Phone Number, which seems straightforward at first, but quickly tests how well you actually understand recursive thinking. The real challenge wasn’t writing code — it was thinking in terms of: • Breaking the problem into smaller subproblems • Building combinations step by step • Managing the recursive flow correctly Key learning: Recursion is not about memorizing patterns — it’s about visualizing the decision tree and trusting the process. One mistake I noticed: If you don’t clearly understand the base case and transitions, recursion becomes confusing very fast. What improved today: • Better clarity on how combinations are formed • Stronger grip on recursion structure (index + choices) • More confidence in handling backtracking-style problems Hard truth: Recursion feels difficult because the thinking is different — not because the problem is hard. And that’s exactly why it’s important to master it. #90DaysOfCode #DSA #Java #Recursion #Backtracking #LeetCode #ProblemSolving
To view or add a comment, sign in
-
-
🔥 Day 31/100 – DSA Problem Solving 📌 Problem: 412. Fizz Buzz (LeetCode) Today’s problem looks simple, but it really tests your logic building and attention to detail. 💡 My Approach: I used a loop from 1 to n For each number: If divisible by both 3 & 5 → "FizzBuzz" If divisible by 3 → "Fizz" If divisible by 5 → "Buzz" Otherwise → convert number to string 🧠 What I Learned Today: ✅ Importance of using the correct variable inside loops ✅ Order of conditions matters (3 & 5 first) ✅ Writing clean and readable logic ✅ Even easy problems can teach debugging skills 🚀 Key Takeaway: Don’t underestimate easy problems — they help build strong fundamentals and improve problem-solving thinking. 💻 Code Concept: Used simple loop + conditional statements + list to store results. #Day31 #100DaysOfCode #DSA #LeetCode #Java #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 17 of LeetCode Problem Solving Solved today’s problem — LeetCode #13: Roman to Integer 💻🔥 ✅ Approach: Traversal + Mapping ⚡ Time Complexity: O(n) 📊 Space Complexity: O(1) The task was to convert a Roman numeral string into an integer. 👉 I mapped each Roman symbol to its value and traversed the string to calculate the result. 💡 Key Idea: If current value < next value → subtract it Otherwise → add it 👉 Core Logic: Convert each character to its numeric value Compare with next character Apply addition or subtraction accordingly 💡 Key Learning: Understanding patterns (like subtraction rule in Roman numbers) helps simplify the problem logic. Consistency is the key — improving step by step 🚀 #Day17 #LeetCode #DSA #Java #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 6 of LeetCode Problem Solving Solved today’s problem — LeetCode #1480: Running Sum of 1d Array 💻🔥 ✅ Approach: Prefix Sum (Running Sum) ⚡ Time Complexity: O(n) 📊 Space Complexity: O(n) The task was to compute the running sum of an array where each element represents the sum of all previous elements including itself. 👉 Example: Input: [1,2,3,4] Output: [1,3,6,10] 💡 Key Idea: Keep adding elements as you traverse the array and store the cumulative sum. 👉 Core Logic: Initialize sum = 0 Traverse array Add current element → sum += nums[i] Store in result array 💡 Key Learning: Simple problems help build strong fundamentals — mastering basics like prefix sum is very important for advanced problems. Grateful to my mentor Pulkit Aggarwal — your guidance is helping me strengthen my fundamentals every day 🙌 Consistency is the key — small steps lead to big results 🚀 #Day6 #LeetCode #DSA #Java #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 8 of 30 Days Coding Challenge Today I solved a problem on LeetCode: Minimum Distance Between Three Equal Elements. 🔍 Approach: Initially implemented a brute-force solution using three nested loops (O(n³)). It worked for smaller constraints but highlighted the importance of optimizing. 💡 Key Learning: Instead of checking all possible triplets, grouping indices of identical elements and analyzing consecutive occurrences leads to a much more efficient solution. ⚡ Optimization Insight: Reduced time complexity from O(n³) → O(n) Leveraged HashMap to store indices and process only relevant combinations. 📈 Takeaway: This problem reinforced an important concept: 👉 When dealing with repeated elements, think in terms of grouping and patterns rather than brute force. Consistency is key — learning something new every day and improving step by step. #Day8 #30DaysOfCode #CodingChallenge #LeetCode #Java #DataStructures #Algorithms #ProblemSolving #CodingJourney #SoftwareDevelopment #LearnToCode #TechGrowth
To view or add a comment, sign in
-
-
At first, the Rotate Image problem looked tricky. Rotating a matrix in-place isn’t something that feels obvious right away. But after thinking about it, I realized it’s not about rotation directly, it’s about transforming the matrix step by step. By first flipping it across the diagonal (transpose) and then reversing each row, the rotation happens naturally. Moments like this remind me that in coding, the right approach often matters more than the problem itself. Learning to break problems down is the real skill. RAVI KUMAR Coding Blocks Sunstone #Coding #DSA #Java #ProblemSolving #GrowthMindset #Learning
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