Day: 96/365 📌 LeetCode POTD: Minimum Distance to Type a Word Using Two Fingers Hard Key takeaways/Learnings from this problem: 1. This problem is a great example of DP with state as both fingers’ positions, which feels tricky at first but clicks once you model it right. 2. Key learning: instead of deciding both fingers every time, fix one and optimize the movement of the other to reduce complexity. 3. Precomputing distances between characters makes transitions much faster and keeps the code clean. #POTD #365DaysOfCode #DSA #Java #ProblemSolving #LearningInPublic #Consistency 🥷
Minimum Distance to Type a Word Using Two Fingers LeetCode Solution
More Relevant Posts
-
🚀 Day 33 of #128DaysOfCode 🧩 Problem Insight: The goal was to check whether a given string can be formed by repeating one of its substrings multiple times. 💡 Key Learning: Instead of checking all possible substrings (which can be inefficient), I learned an elegant trick: By concatenating the string with itself and removing the first and last characters, we can determine if the original string exists within it. ⚡ This approach helped me: - Improve my understanding of string patterns - Learn a smart optimization technique - Avoid brute-force solutions 🛠️ Concepts Practiced: - String manipulation - Pattern recognition - Optimized problem-solving approach 📈 Every day I’m getting better at identifying patterns and writing cleaner, more efficient code. #Day33 #128DaysOfCode #Java #DSA #CodingJourney #ProblemSolving #LeetCode
To view or add a comment, sign in
-
-
----Keeping the momentum going.---- Solved: * Length of Last Word (LeetCode 58) * Approach: Traversed the string from the end, skipped trailing spaces, and counted characters of the last word. * Key Learning: Simple problems reinforce strong fundamentals like string traversal and edge case handling. #LeetCode #DSA #Java #ProblemSolving
To view or add a comment, sign in
-
-
DSA Practice Update Today I solved: #876 – Middle of the Linked List Learned how to efficiently find the middle node of a linked list using the fast and slow pointer approach. Understood how moving one pointer twice as fast as the other helps identify the middle element in a single traversal. Key Learnings: • Fast and slow pointer technique • Efficient traversal of linked lists • Solving problems in O(n) time with constant space This problem strengthened my understanding of pointer-based techniques, which are very useful in linked list problems. Continuing to stay consistent and improve problem-solving skills step by step. #DSA #LeetCode #CodingJourney #Java #SoftwareDevelopment #PlacementPreparation
To view or add a comment, sign in
-
-
Day 101 - LeetCode Journey Solved LeetCode 856: Score of Parentheses ✅ Looks tricky at first, but turns out to be a neat pattern problem. Instead of using a stack, used depth tracking + bit manipulation to calculate score efficiently. Core idea: Every "()" contributes 2^depth So just track depth and add score at the right moment. Key learnings: • Understanding pattern inside parentheses • Using depth instead of extra space • Bit manipulation for optimization ⚡ • Clean O(n) solution without stack ✅ All test cases passed ⚡ O(n) time | O(1) space Simple logic, powerful result 💡 #LeetCode #DSA #Stack #BitManipulation #Java #CodingJourney #ProblemSolving #InterviewPrep
To view or add a comment, sign in
-
-
🚀 Day 53 of #100DaysOfLeetCode Solved: Next Greater Element (Leetcode 496) Today’s problem was a great reminder of how powerful Monotonic Stack can be for optimization. 🔹 Approach: Used a stack to maintain decreasing elements Mapped each element to its next greater using a HashMap Reduced time complexity from O(n²) → O(n) 🔹 Key Learning: Small mistakes in conditions (like missing a !) can completely break logic. Attention to detail matters just as much as understanding the concept. 🔹 Complexity: Time: O(n + m) Space: O(n) Consistency > Perfection. Showing up daily and improving step by step. #LeetCode #DSA #Java #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
#Day82 Of Problem Solving Solved today’s LeetCode Daily Question and got all test cases accepted. Focused on finding the minimum distance between the target element and the given start index. Kept the approach simple—iterated through the array and updated the minimum distance using Math.abs(). Clean logic, efficient, and gets the job done. Performance: Runtime: 1 ms Memory: 45.04 MB Small problems like this are a good reminder that clarity in thinking often beats overcomplication. Staying consistent with daily practice. #LeetCode #Java #ProblemSolving #DSA #CodingJourney #LeetCode #LinkedIn
To view or add a comment, sign in
-
-
Day 17 of #100DaysOfCode Solved Plus One (Easy) today. A simple but important problem that reinforces handling edge cases carefully. Key Idea: Traverse from the last digit, handle carry properly. Approach: Start from the end of the array If digit < 9 → increment and return If digit == 9 → make it 0 and carry forward If all digits are 9 → create new array with leading 1 Learning: Even the easiest problems test your attention to edge cases. Consistency > Complexity. #LeetCode #DSA #CodingJourney #Java #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
----Back to solving and staying consistent. Solved: * Unique Email Addresses (LeetCode 929) * Approach: Used a HashSet to store normalized emails by: • Ignoring everything after ‘+’ in the local name • Removing all ‘.’ from the local name • Keeping the domain unchanged * Key Learning: String manipulation + hashing can simplify problems that look complex at first. #LeetCode #DSA #Java #ProblemSolving
To view or add a comment, sign in
-
-
🔥 Day 61 of #100DaysOfCode Solved – Contains Duplicate II 🔍 What I did: Used a sliding window approach with a HashSet to track elements within a range of size k, checking for duplicates efficiently. 💡 Key Learning: Understood the concept of sliding window technique Learned how to use HashSet for quick duplicate checks Practiced controlling window size by removing outdated elements 🎯 Takeaway: Combining sliding window with hashing helps solve problems efficiently without extra complexity. #Day61 #LeetCode #Java #ProblemSolving #CodingJourney #100DaysOfCode #DSA
To view or add a comment, sign in
-
-
Day 57 — small improvements, big impact 🚀 Solved the Maximum Triplet Sum problem today, focusing on writing cleaner and more efficient logic. Used a HashSet to eliminate duplicates and simplified the approach with sorting. It’s interesting how a small optimization can make the solution more robust and elegant. Consistency is starting to pay off — problems feel more approachable, and thinking is getting sharper 💡 Learning to not just solve, but refine solutions is the real progress. On to Day 58 with the same mindset 🔥 #100DaysOfCode #Java #DSA #ProblemSolving #CodingJourney #Consistency #Learning #SoftwareDevelopment
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