Check if Rectangles Overlap
Given two axis-aligned rectangles, check if they overlap.
We'll cover the following...
Statement
Given the bottom-left and top-right coordinates of two axis-aligned rectangles, check if the two rectangles overlap. Return true
if they overlap, otherwise, return false
.
Note: Two rectangles that only touch at the corner or edges do not overlap.
Example
In the following example, we have two overlapping rectangles: Rectangle1
and Rectangle2
.
Sample input
Rectangle1 = [0, 0, 2, 2]
Rectangle2 = [1, 1, 3, 3]
...