Day 97 of #100DaysOfCode 💻 📌 LeetCode Problem 482 – License Key Formatting Today’s problem focused on string manipulation and formatting logic. 🔹 The task: Reformat a license key string so that: All letters are uppercase Groups are separated by - Each group has exactly k characters, except possibly the first 🔹 What I practiced: Traversing strings from the end Using StringBuilder efficiently Handling edge cases like trailing dashes and mixed characters 🔹 Approach: Remove all existing dashes Convert letters to uppercase Build new groups from the end and reverse the result 📚 Language: Java 🧠 Concepts: Strings, StringBuilder, Edge Cases, Formatting 97 days down — almost at the finish line! 💪🔥 #Day97 #LeetCode #Java #DSA #100DaysChallenge #StringManipulation #CodingJourney #Consistency
LeetCode 482: License Key Formatting in Java
More Relevant Posts
-
Day 97 of #100DaysOfCode 💻 📌 LeetCode Problem 482 – License Key Formatting Today’s problem focused on string manipulation and formatting logic. 🔹 The task: Reformat a license key string so that: All letters are uppercase Groups are separated by - Each group has exactly k characters, except possibly the first 🔹 What I practiced: Traversing strings from the end Using StringBuilder efficiently Handling edge cases like trailing dashes and mixed characters 🔹 Approach: Remove all existing dashes Convert letters to uppercase Build new groups from the end and reverse the result 📚 Language: Java 🧠 Concepts: Strings, StringBuilder, Edge Cases, Formatting 97 days down — almost at the finish line! 💪🔥 #Day97 #LeetCode #Java #DSA #100DaysChallenge #StringManipulation #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Day 97 of #100DaysOfCode 💻 📌 LeetCode Problem 482 – License Key Formatting Today’s problem focused on string manipulation and formatting logic. 🔹 The task: Reformat a license key string so that: All letters are uppercase Groups are separated by - Each group has exactly k characters, except possibly the first 🔹 What I practiced: Traversing strings from the end Using StringBuilder efficiently Handling edge cases like trailing dashes and mixed characters 🔹 Approach: Remove all existing dashes Convert letters to uppercase Build new groups from the end and reverse the result 📚 Language: Java 🧠 Concepts: Strings, StringBuilder, Edge Cases, Formatting 97 days down — almost at the finish line! 💪🔥 #Day97 #LeetCode #Java #DSA #100DaysChallenge #StringManipulation #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 LeetCode #392 | Is Subsequence Solved LeetCode #392 – Is Subsequence using the Two Pointer technique in Java. 🔍 Core Idea : Traverse both strings simultaneously and try to match characters in order. 🧠 Logic Breakdown: Initialize two pointers sp → pointer for string s tp → pointer for string t Traverse string t from left to right If s.charAt(sp) == t.charAt(tp) → move sp forward Always move tp forward At the end, check whether all characters of s are matched ✅ If sp == s.length() → s is a subsequence of t ⏱ Complexity Time: O(n) Space: O(1) ✔ Accepted ⚡ Clean and efficient solution #LeetCode392 #LeetCode #TwoPointers #Java #DSA #ProblemSolving #CodingJourney #Consistency #FullStackDevelopment
To view or add a comment, sign in
-
-
🚀 Day 77 of LeetCode Challenge ✅ Problem: Add Strings 🔗 https://lnkd.in/gZatGJzA 💡 Approach: Traverse both strings from right to left Convert characters to digits and add them with a carry Append the result digit-by-digit using StringBuilder Reverse the final string to get the correct sum ⚡ Performance: ✅ All test cases passed ⏱ Runtime: 2 ms (Beats 91.47%) 💾 Memory efficient and clean implementation 📚 Key Learning: When direct numeric conversion isn’t allowed, manual digit-by-digit addition is a reliable and efficient strategy for handling large numbers stored as strings. 🔧 Language: Java 📈 Consistency over intensity—one problem at a time. #LeetCode #DSA #Java #StringManipulation #MathProblems #DailyCoding #Consistency #Day77
To view or add a comment, sign in
-
-
#Day_62 Problem: Roman to Integer (LeetCode 13) Converting Roman numerals into integers looks easy, but the subtraction rules make it interesting! 🏛️ 🧠 Insights: • Roman numerals usually add values left to right • Subtraction happens when a smaller value appears before a larger one • Traversing from right to left simplifies the logic ⚙️ Approach Used: • Store Roman symbols and values in a HashMap • Start from the last character • If current value < next value → subtract • Else → add to total 📌 What this improved: • HashMap usage • String traversal logic • Pattern recognition in number systems ✨ Understanding the rule is more important than memorizing it. #Day61 #RomanToInteger #LeetCode #Java #DSA #ProblemSolving #DailyCoding
To view or add a comment, sign in
-
-
#Day_63 Problem: Reverse Prefix of Word (LeetCode 2000) A clean string manipulation problem that tests attention to detail ✂️ 🧠 Insights: • Reverse only the substring till first occurrence of a character • If the character doesn’t exist, return the original string • StringBuilder makes reversal efficient ⚙️ Approach Used: • Traverse string until character is found • Reverse the prefix using StringBuilder • Append the remaining characters as-is 📌 What this improved: • StringBuilder operations • Handling early break conditions • Edge case handling ✨ Small problems sharpen precision. #Day62 #ReversePrefix #LeetCode #Java #Strings #DSA #DailyCoding
To view or add a comment, sign in
-
-
Day 38 — DSA | Linked List Cycle Detection (LeetCode 141) Today I worked on detecting a cycle in a linked list using Floyd’s Tortoise and Hare algorithm. Instead of extra memory, the idea is simple: Use two pointers Move one step vs two steps If they ever meet → cycle exists Why this problem matters: Tests pointer manipulation Reinforces thinking in O(n) time & O(1) space Very common in interviews to check fundamentals I also implemented a user-input version in Java to understand how cycles are actually formed, not just detected. Small problem, but strong concept. Consistency > complexity. #DSA #Day38 #LinkedList #Java #ProblemSolving #LeetCode #CodingJourney #FloydsAlgorithm #LearnByDoing #DataStructureAndAlgorithm
To view or add a comment, sign in
-
-
🚀 Day 50 of #100DaysOfCode Solved LeetCode Problem #1458 – Max Dot Product of Two Subsequences ✅ This problem focused on finding the maximum dot product between non-empty subsequences of two arrays. The tricky part was handling negative values and ensuring at least one pair is always chosen. Key Learnings: -> Used Dynamic Programming with memoization to avoid recomputation -> Carefully handled the base case using Integer.MIN_VALUE to enforce non-empty subsequences -> Explored the classic include vs exclude decision at each index -> Strengthened understanding of DP on two sequences Language Used: Java -> Runtime: 11 ms (Beats 59.26%) -> Memory: 48.77 MB Step by step, sharpening DP intuition and edge-case handling 🚀 #LeetCode #DynamicProgramming #Java #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
#Day_59 Problem: 4Sum (LeetCode 18) Day 57 pushed the limits with 4Sum — finding all unique quadruplets equal to a target! 💥 🧠 Key Takeaways: This is an extension of 3Sum → fix two elements + two pointers. Sorting is the backbone. Duplicate skipping at both outer and inner levels is critical. Use long for sum to avoid overflow. ⚙️ Optimized Approach: Sort the array. Fix i and j. Apply two pointers for remaining part. Carefully skip duplicates. ⏱️ Complexity: O(n³), but still efficient compared to brute force. 📌 This problem taught me: How patterns scale from 2Sum → 3Sum → 4Sum. Writing clean, duplicate-free logic. Consistency + patterns = confidence! 💪 #Day57 #4Sum #LeetCode #Java #DSA #CodingPractice #LearnByDoing
To view or add a comment, sign in
-
-
LeetCode Practice - 482. License Key Formatting 🔹 Formatting Rules ✔ Remove all existing dashes (-) ✔Convert all letters to uppercase ✔Split the string into groups of size k ✔All groups must have exactly k characters ✔Except the first group, which: ✔Can be shorter than k ✔Must contain at least 1 character ✔Insert a dash (-) between each group 🔹 Why Group From Right to Left? Because: Only the first group can be smaller All other groups must be exactly k characters Grouping from the end makes this easier #LeetCode #Java #StringHandling #CodingPractice #ProblemSolving #DSA #DeveloperJourney #TechLearning
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
Full-Stack Developer (Kotlin/Java) & DevOps Engineer @ LSEG (London Stock Exchange Group) | Oracle Java Certified | HashiCorp Terraform & 2x AWS Certified
4moyour approach with stringbuilder really shows how much thought went into the efficiency side of things. the way you handled that tricky first group situation by working backwards is clever.