4002 LeetCode problem solution
LeetCode 4002 Count Valid Sequences solution using Combinatorics and Complement Counting. Count all positive compositions and subtract all-odd sequences.
Read moreLeetCode 4002 Count Valid Sequences solution using Combinatorics and Complement Counting. Count all positive compositions and subtract all-odd sequences.
Read moreLeetCode 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 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 moreLeetCode 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 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 more