🚀 Day 72 of #100DaysOfCode Solved LeetCode Problem #2977 – Minimum Cost to Convert String II ✅ This was a more advanced follow-up that required handling string-level transformations efficiently. The challenge was to minimize the total cost by choosing optimal substring conversions rather than single-character changes. Key Learnings: -> Using a Trie to store and index valid string transformations -> Modeling transformation costs with dynamic programming -> Combining Trie traversal + DP for efficient substring matching -> Carefully managing state transitions to avoid unnecessary recomputation Language Used: Java -> Runtime: 209 ms (Beats 34.88%) -> Memory: 48.68 MB (Beats 18.60%) Step by step, leveling up problem-solving depth and string algorithm intuition 🚀 #LeetCode #DynamicProgramming #Trie #Java #ProblemSolving #100DaysOfCode
LeetCode 2977: Minimum Cost String Conversion with Trie and DP
More Relevant Posts
-
🚀 Day 85 of #100DaysOfCode Solved LeetCode Problem #3713 – Longest Balanced Substring I ✅ A classic string + frequency-based problem that rewards careful iteration and validation. The goal was to find the longest substring where all present characters appear the same number of times—simple idea, but requires disciplined checking. Key Takeaways: -> Brute-force with pruning can still pass when constraints allow -> Frequency arrays are powerful for substring analysis -> Early balance checks save unnecessary computation -> Always align solution strategy with input limits Language: Java -> Runtime: 83 ms (Beats 88.95%) ⚡ -> Memory: 47.29 MB Small wins matter. Staying consistent, one problem at a time. 💻🔥 #LeetCode #Java #Strings #ProblemSolving #Algorithms #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 81 of #100DaysOfCode Solved LeetCode Problem #110 – Balanced Binary Tree ✅ A classic tree problem that rewards thinking bottom-up. Instead of recalculating heights repeatedly, combining height computation with balance checking makes the solution both clean and efficient. Key Takeaways: -> Bottom-up recursion simplifies tree problems -> Early termination saves unnecessary computation -> Returning sentinel values (-1) is a powerful pattern -> One DFS can solve both height & balance checks Language: Java -> Runtime: 0 ms (Beats 100%) ⚡ -> Memory: 45.76 MB Staying consistent, one tree at a time. 🌳💻🔥 #LeetCode #Java #BinaryTree #Recursion #DFS #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 78 of #100DaysOfCode Solved LeetCode Problem #3379 – Transformed Array ✅ A clean and elegant problem focused on index manipulation and modular arithmetic. The key was handling circular indexing correctly, especially with negative shifts—simple logic, but precision matters. Key Takeaways: -> Using modulo smartly to handle circular arrays -> Dealing with negative indices safely -> Writing concise and readable transformations -> Small problems still demand careful edge-case thinking Language: Java -> Runtime: 1 ms (Beats 98.72%) ⚡ -> Memory: 47.08 MB Consistency > Complexity. Keep moving forward. 💻🔥 #LeetCode #Java #Arrays #ModularArithmetic #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🎯 Day 100 of #100DaysOfCode 🔥 What a way to wrap it up! Solved LeetCode #3666 – Minimum Operations to Equalize Binary String ✅ A problem that blends math, parity logic, and careful case analysis—not your usual binary flip question. Key takeaways: -> Count-based optimization over brute force -> Handling even/odd operation patterns smartly -> Early exits = cleaner & faster logic -> Thinking in terms of operations feasibility rather than simulation 🧠 Language: Java -> Runtime: 0 ms (Beats 83.87%) -> Memory: 47.90 MB 100 days. Countless problems. One habit built: consistency 💪 Onward to harder problems and deeper concepts 🚀 #LeetCode #Java #DSA #BinaryStrings #ProblemSolving #Consistency #100DaysChallenge
To view or add a comment, sign in
-
-
🚀 Day 75 of #100DaysOfCode Solved LeetCode Problem #3013 – Divide an Array Into Subarrays With Minimum Cost II ✅ This one was a step up from Part I — combining sliding window logic with ordered data structures (TreeSet) to efficiently track minimum costs under constraints. Key Takeaways: -> Smart use of TreeSet for dynamic minimum tracking -> Handling window constraints (k, dist) cleanly -> Balancing correctness with performance in greedy-style problems -> Thinking beyond brute force for optimization Language: Java -> Runtime: 332 ms (Beats 47.83%) -> Memory: 105.54 MB Consistency > Perfection. One problem at a time. 💻🔥 #LeetCode #Java #DataStructures #Greedy #SlidingWindow #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 80 of #100DaysOfCode Solved LeetCode Problem #1653 – Minimum Deletions to Make String Balanced ✅ A clean greedy + DP-style problem that looks simple but really tests decision-making at each step. The trick is choosing whether to delete a character now or rely on previous counts to minimize total deletions. Key Takeaways: -> Greedy decisions can be optimized with running state -> Tracking counts (bCount) simplifies future choices -> Sometimes the best DP is just two variables -> Elegant logic beats complex data structures Language: Java -> Runtime: 19 ms (Beats 93.09%) ⚡ -> Memory: 47.80 MB Showing up daily, sharpening logic, and trusting the process. 💻🔥 #LeetCode #Java #Greedy #DynamicProgramming #Strings #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 79 of #100DaysOfCode Solved LeetCode Problem #3634 – Minimum Removals to Balance Array ✅ This problem was a great example of how sorting + sliding window can turn a tricky constraint problem into a clean and efficient solution. The goal was to keep the largest valid subarray and remove the rest—simple idea, but execution matters. Key Takeaways: -> Sorting helps simplify balance conditions -> Sliding window is powerful for range-based constraints -> Maximizing what you keep is often better than counting what you remove -> Careful pointer movement avoids unnecessary recomputation Language: Java -> Runtime: 23 ms (Beats 100.00%) ⚡ -> Memory: 86.17 MB Consistency beats intensity. One solid problem every day. 💻🔥 #LeetCode #Java #SlidingWindow #TwoPointers #Arrays #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 10 of Daily DSA 🚀 Solved LeetCode 190: Reverse Bits ✅ 🔍 Approach: Worked with the 32-bit representation of the given integer: • Converted the number into a fixed 32-bit binary string • Used a two-pointer technique to reverse the bits • Converted the reversed binary back to an unsigned integer This approach keeps the logic simple while ensuring correctness for signed integers. ⏱ Complexity: • Time: O(32) = O(1) (constant time) • Space: O(32) = O(1) 📊 LeetCode Stats: • Runtime: 9 ms • Memory: 43.46 MB A good reminder that clarity matters more than micro-optimizations when learning bit manipulation. #DSA #LeetCode #Java #BitManipulation #ProblemSolving #DailyCoding #Consistency
To view or add a comment, sign in
-
-
🚀 Day 82 of #100DaysOfCode Solved LeetCode Problem #1382 – Balance a Binary Search Tree ✅ This problem is a great reminder that sometimes rebuilding is better than fixing. By leveraging the sorted nature of BSTs, converting it to a balanced tree becomes clean and intuitive. Key Takeaways: -> Inorder traversal gives a sorted sequence in BST -> Divide & conquer helps rebuild a height-balanced tree -> Choosing the middle element ensures balance -> Clean recursion beats complex rotations here Language: Java -> Runtime: 2 ms (Beats 97.82%) ⚡ -> Memory: 48.44 MB Consistency compounds. Trees today, forests tomorrow. 🌳💻🔥 #LeetCode #Java #BinarySearchTree #Recursion #DivideAndConquer #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 98 of #100DaysOfCode Solved LeetCode #1356 – Sort Integers by The Number of 1 Bits ✅ A clean bit manipulation + sorting problem that rewards thinking beyond plain comparisons. Key Takeaways: -> Using Integer.bitCount() to count set bits efficiently -> Encoding sort priority directly into values for simplicity -> Leveraging built-in sorting for clean and fast solutions -> Small tricks can lead to elegant code ✨ Language: Java -> Runtime: 6 ms (Beats 93.70%) ⚡ -> Memory: 47.42 MB Almost there. Staying consistent till the end 💻🔥 #LeetCode #Java #BitManipulation #Sorting #ProblemSolving #DSA #100DaysOfCode
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