🚀 Day 69 of #100DaysOfCode Solved LeetCode Problem #3650 – Minimum Cost Path with Edge Reversals ✅ This problem was a great application of graph algorithms, where the goal was to minimize cost by smartly handling edge directions and reversals. Modeling the problem correctly made all the difference. Key Learnings: -> Converting edge reversals into weighted edges -> Using graph representation effectively -> Applying Dijkstra’s algorithm for shortest path -> Thinking beyond direct edges to optimize cost Language Used: Java -> Runtime: 75 ms (Beats 85.02%) -> Memory: 275.60 MB (Beats 39.27%) Consistency > Motivation 🚀 Onwards to Day 68 💪 #LeetCode #GraphAlgorithms #Dijkstra #Java #ProblemSolving #100DaysOfCode
LeetCode 3650: Minimum Cost Path with Edge Reversals in Java
More Relevant Posts
-
🚀 Day 71 of #100DaysOfCode Solved LeetCode Problem #2976 – Minimum Cost to Convert String I ✅ This problem revolved around graph algorithms and all-pairs shortest paths, where each character transformation had an associated cost. The key was efficiently finding the minimum cost to convert one string into another using allowed transformations. Key Learnings: -> Modeling character transformations as a weighted directed graph -> Applying Floyd–Warshall to precompute minimum conversion costs -> Handling unreachable transformations safely -> Aggregating per-character costs to compute the final answer Language Used: Java -> Runtime: 91 ms (Beats 13.62%) -> Memory: 48.16 MB (Beats 30.82%) Consistent progress, one problem at a time 🚀 On to the next challenge 💪 #LeetCode #Graphs #FloydWarshall #Java #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 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
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 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 68 of #100DaysOfCode Solved LeetCode Problem #1200 – Minimum Absolute Difference ✅ A clean and elegant problem where sorting does most of the heavy lifting. By comparing adjacent elements after sorting, we can efficiently find all pairs with the minimum absolute difference. Key Learnings: -> Sorting simplifies difference-based problems -> Adjacent comparison is enough after sorting -> Clear logic beats complex data structures -> Collecting results while tracking the minimum difference Language Used: Java -> Runtime: 20 ms (Beats 97.70%) -> Memory: 64.05 MB (Beats 32.62%) Step by step, day by day 🚀 On to the next problem 💪 #LeetCode #Java #ProblemSolving #Algorithms #Sorting #Arrays #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 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 11 of Daily DSA 🚀 Solved LeetCode 1800: Maximum Ascending Subarray Sum ✅ 🔍 Approach: Iterated through the array while maintaining the sum of the current strictly increasing subarray. Whenever the sequence breaks, a new subarray sum is started and stored. Finally, the maximum subarray sum is obtained from the stored values. This method clearly separates each ascending subarray and helps in understanding the problem flow. ⏱ Complexity: • Time: O(n) — single traversal + max lookup • Space: O(n) — list used to store subarray sums 📊 LeetCode Stats: • Runtime: 1 ms ⚡ • Memory: 43.30 MB A good learning step before optimizing further to constant space. #DSA #LeetCode #Java #Arrays #ProblemSolving #DailyCoding #Consistency
To view or add a comment, sign in
-
-
Day 14 of Daily DSA 🚀 Solved LeetCode 153: Find Minimum in Rotated Sorted Array ✅ Approach: Used Binary Search to locate the minimum element in a rotated sorted array. At each step, compared nums[mid] with nums[end] to determine which half is unsorted and contains the minimum. By shrinking the search space intelligently, the minimum element is found efficiently. A great example of how Binary Search adapts to rotated arrays. ⏱ Complexity: • Time: O(log n) • Space: O(1) 📊 LeetCode Stats: • Runtime: 0 ms (Beats 100%) ⚡ • Memory: 43.66 MB (Beats 87.66%) Binary Search mastery keeps leveling up 💪 #DSA #LeetCode #Java #BinarySearch #ProblemSolving #DailyCoding #Consistency
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