🚀 Day 67 of #100DaysOfCode Solved LeetCode Problem #1984 – Minimum Difference Between Highest and Lowest of K Scores ✅ This problem focused on minimizing the score gap by smartly selecting k elements after sorting the array. A perfect example of how sorting + sliding window logic can turn a problem simple and efficient. Key Learnings: -> Sorting simplifies comparisons -> Sliding window to evaluate consecutive groups of size k -> Avoid brute force by leveraging order -> Small observations lead to clean solutions Language Used: Java -> Runtime: 8 ms (Beats 89.22%) -> Memory: 47.09 MB (Beats 25.34%) Consistency > Intensity 💪 On to the next challenge 🚀 #LeetCode #Java #ProblemSolving #Algorithms #Sorting #SlidingWindow #100DaysOfCode
LeetCode 1984: Minimizing Score Gap with Sorting and Sliding Window
More Relevant Posts
-
🚀 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 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 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 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 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
-
-
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 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
-
-
LeetCode Daily — Problem #3794: Reverse String Prefix Today’s challenge was a fun string manipulation task: Problem: Given a string s and an integer k, reverse the first k characters and return the resulting string. Example: Input: s = "abcd", k = 2 Output: "bacd" Approach: I converted the string to a character array, reversed the first k characters using a loop, and then appended the rest. Here's the Java solution:✅ Result: Accepted with 0 ms runtime! Takeaway: This problem reinforced how simple logic and clean iteration can solve string-based challenges efficiently. It’s a great reminder that even “Easy” problems can sharpen your fundamentals. #LeetCode #Java #StringManipulation #CodingChallenge #100DaysOfCode #ProblemSolving #LinkedInLearning
To view or add a comment, sign in
-
-
Day 46: Binary Addition from scratch! 🔢 Problem 67: Add Binary Java's BigInteger is a thing, but manual bit manipulation is just more satisfying. My approach: 1. Padded both strings to the same length using character arrays. 2. Simulated schoolbook addition from right to left. 3. Used % 2 for the result bit and / 2 for the carry. It’s a clean O(N) solution that avoids overflow and keeps the logic transparent. No shortcuts, just pure logic. 🚀 #LeetCode #Java #Binary #Algorithms #CodingChallenge #ProblemSolving
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
-
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