Rectangle Overlap
From LeetCode. Overlap detection. Solve the geometry problem "Rectangle Overlap".
Examples
Input: [1,2,3]
Output: 0
Input: [2,3,4]
Output: 0
Hints
Two axis-aligned rectangles overlap when their projections on both the x-axis and y-axis intersect. If either axis has no overlap, the rectangles cannot overlap.
For axis ranges [ax1, ax2] and [bx1, bx2], they overlap when max(ax1, bx1) < min(ax2, bx2). Apply the same formula to the y-axis.
Check the negation first — rectangles do NOT overlap when one is entirely left, right, above, or below the other (four simple comparisons). Return early for non-overlap.
Rectangle Overlap
**From LeetCode.** Overlap detection. Solve the geometry problem "Rectangle Overlap".