🚀 Day 56 of #100DaysOfCode Solved LeetCode Problem #3454 – Separate Squares II. This was a more advanced extension of Separate Squares I, requiring a deeper geometric insight. The problem focused on finding a horizontal line that splits the total area of multiple squares equally, but this time with overlapping projections, making it significantly more challenging. Key Learnings: -> Applied sweep line technique with event-based processing -> Managed overlapping x-intervals efficiently -> Calculated area contributions dynamically while sweeping along the y-axis -> Strengthened understanding of computational geometry + precision handling Language Used: Java -> Runtime: 191 ms (Beats 81.13%) -> Memory: 115.22 MB (Beats 76.42%) From binary search to sweep line — evolving step by step 🚀 #LeetCode #ComputationalGeometry #SweepLine #Java #ProblemSolving #100DaysOfCode
LeetCode #3454: Separate Squares II with Sweep Line Technique
More Relevant Posts
-
🚀 Day 58 of #100DaysOfCode Solved LeetCode Problem #2975 – Maximum Square Area by Removing Fences From a Field. This problem revolved around finding the largest possible square area after selectively removing horizontal and vertical fences. The core idea was to analyze maximum consecutive gaps between fences in both directions and use them to compute the optimal square. Key Learnings: -> Extending fence arrays with boundaries to simplify gap calculation -> Sorting and scanning to find maximum consecutive distances -> Translating 1D gap analysis into a 2D geometric solution -> Handling edge cases efficiently for large inputs Language Used: Java -> Runtime: 406 ms (Beats 86.90%) -> Memory: 166.59 MB (Beats 60.71%) One more step forward in consistency, clarity, and confidence 🚀 #LeetCode #Arrays #Greedy #Geometry #Java #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 57 of #100DaysOfCode Solved LeetCode Problem #2943 – Maximize Area of Square Hole in Grid. This problem focused on identifying the largest possible square that can be formed after removing horizontal and vertical bars from a grid. The key was to analyze consecutive gaps efficiently and translate them into the maximum square area. Key Learnings: -> Sorting input arrays to simplify gap analysis -> Tracking longest consecutive segments in both dimensions -> Understanding how grid constraints map directly to square geometry -> Writing clean, optimal logic for interval-based problems Language Used: Java -> Runtime: 4 ms (Beats 100.00%) -> Memory: 45.45 MB (Beats 50.00%) Consistent problem-solving, sharper logic, one day at a time 🚀 #LeetCode #Arrays #Geometry #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 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
-
-
🚀 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 46/100 – LeetCode Challenge ✅ Problem: #3010 Divide an Array Into Subarrays With Minimum Cost I Difficulty: Easy Language: Java Approach: Greedy with Sorting Time Complexity: O(n log n) Space Complexity: O(1) Key Insight: First element must be in first subarray. Remaining subarrays each need one element. Minimize cost by picking the two smallest elements from the remaining array for the other subarray starting points. Sort remaining elements to efficiently find the two smallest. Solution Brief: Separated first element (always in cost), sorted rest of array in ascending order. Summed first element + two smallest from sorted portion → minimum total division cost. #LeetCode #Day46 #100DaysOfCode #Greedy #Sorting #Java #Algorithm #CodingChallenge #ProblemSolving #ArrayDivision #EasyProblem
To view or add a comment, sign in
-
-
Day 39/100 – LeetCode Challenge ✅ Problem: #1984 Minimum Difference Between Highest and Lowest of K Scores Difficulty: Easy Language: Java Approach: Sorting + Sliding Window Time Complexity: O(n log n) Space Complexity: O(1) Key Insight: After sorting, the minimum range in k elements must come from consecutive elements in sorted order. Sliding window of size k finds the minimum difference between first and last element in window. Solution Brief: Sorted the array to bring close values together. Initialized answer with first k elements. Slided window across array, updating minimum difference. Finding minimal range in sorted array with sliding window #LeetCode #Day39 #100DaysOfCode #Sorting #SlidingWindow #Java #Algorithm #CodingChallenge #ProblemSolving #MinimumDifference #EasyProblem #Array #Optimization #DSA
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 77 of #100DaysOfCode Solved LeetCode Problem #3640 – Trionic Array II ✅ This problem builds on Trionic Array I and shifts the focus to maximizing the trionic subarray sum, making it more about optimization than validation. Clean iteration and careful handling of increasing/decreasing phases were key here. Key Takeaways: -> Extending pattern-based logic into optimization -> Efficient traversal with precise index control -> Handling negative values and edge cases gracefully -> Favoring linear scans over brute-force approaches Language: Java -> Runtime: 3 ms (Beats 94.87%) ⚡ -> Memory: 95.20 MB Consistency beats intensity. One problem at a time. 💻🔥 #LeetCode #Java #Arrays #TwoPointers #Optimization #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