836 LeetCode problem solution
LeetCode 836 Rectangle Overlap solution using the Interval Overlap pattern. The solution is just one line of code. Using this pattern we simply check whether the rectangles overlap on both the X and Y axes, which takes O(1) time and O(1) space.
Read moreLeetCode 836 Rectangle Overlap problem Elixir solution
LeetCode 836 Rectangle Overlap Elixir solution using the Interval Overlap pattern. Using this pattern we simply check whether the rectangles overlap on both the X and Y axes, which takes O(1) time and O(1) space.
Read more835 LeetCode problem solution
LeetCode 835 Image Overlap solution with O(n⁴) worst-case time complexity. Despite the complexity, the approach works efficiently because the constraints limit the image size to n ≤ 30. This problem shows once again why, in a coding interview, you should ask about the constraints first and only then implement the solution.
Read moreLeetCode 835 Image Overlap Elixir solution
LeetCode 835 Image Overlap solution in Elixir using coordinate translation and frequency counting patterns. The O(n⁴) worst-case approach remains practical because the matrix size is limited to n ≤ 30.
Read more3414 LeetCode problem solution
For solving this problem we need to use the Weighted Interval Scheduling pattern with Dynamic Programming and Binary Search patterns. First, we sort all intervals by their right endpoint while keeping their original indices. For each interval, we use binary search to find the last interval whose right endpoint is strictly smaller than the current left endpoint.
Read more