🚀 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
LeetCode 1200: Minimum Absolute Difference with Java Sorting
More Relevant Posts
-
🚀 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 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 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 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 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
-
-
🚀 Cracked LeetCode 189 – Rotate Array using an optimized in-place approach. Instead of brute force (O(n × k)), I implemented the reverse algorithm technique to achieve: ✅ Time Complexity: O(n) ✅ Space Complexity: O(1) ✅ 0 ms runtime (Beats 100%) Focused on improving optimization thinking and writing clean, efficient Java code. #LeetCode #Java #DataStructures #Algorithms #ProblemSolving #TechGrowth
To view or add a comment, sign in
-
-
🚀 Day 90 of #100DaysOfCode | LeetCode Daily Solved LeetCode Problem #401 – Binary Watch ⌚💻✅ A fun problem that blends bit manipulation with simple iteration. The idea is to count set bits for hours and minutes and generate all valid time combinations. Key Takeaways: -> Smart use of Integer.bitCount() for counting LEDs -> Separating hours (0–11) and minutes (0–59) cleanly -> Formatting time output correctly (leading zeros matter!) -> Brute force done right with clear constraints Language: Java -> Runtime: 3 ms (Beats 91.19%) -> Memory: 43.45 MB (Beats 94.31%) Consistency builds confidence. 90 days in — still pushing forward. 🔥💻 #LeetCode #Java #BitManipulation #BinaryWatch #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 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
To view or add a comment, sign in
-
-
Strings look simple until edge cases show up 👀 Day 8 / #100DaysOfCode 🚀 Solved: Valid Palindrome (LeetCode 125) 🔹 Approach: Used the two-pointer technique starting from both ends. Ignored non-alphanumeric characters and compared characters after converting the string to lowercase. Time Complexity: O(n) Space Complexity: O(1) ✔ Practiced string traversal with pointers ✔ Handled real-world edge cases (spaces, symbols, cases) ✔ Avoided extra space by working in-place 💡 Takeaway: Clean pointer logic often beats preprocessing with extra data structures. Building strong fundamentals in Java, one problem at a time. #LearnInPublic #100DaysOfCode #DSA #Java #Strings #ProblemSolving #SoftwareEngineer #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Day 44 - LeetCode Journey Solved LeetCode 917: Reverse Only Letters in Java ✅ A clean two-pointer problem that really tests your understanding of string manipulation. The goal was simple: reverse only the letters while keeping all non-letter characters in their original positions. Instead of creating extra data structures, I used two pointers from both ends. If a character is not a letter, we skip it. When both pointers land on letters, we swap them. This continues until the pointers meet. What I liked about this problem is how it teaches you to control movement smartly rather than brute forcing the solution. Key takeaways: • Two-pointer technique for efficient traversal • Handling edge cases (symbols, numbers) • Writing in-place logic without extra space • Clean and readable code ✅ All test cases passed ✅ 100% runtime performance Problems like this improve your thinking for real interview scenarios where optimization matters. #LeetCode #DSA #Java #Strings #TwoPointers #Algorithms #ProblemSolving #CodingJourney #InterviewPrep #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
Love your consistency 😍