# Rectangle Overlap Check

MATH

### Problem

Given two axis-aligned rectangles `rec1`

and `rec2`

defined by their bottom-left and top-right coordinates, determine if the rectangles overlap.

The rectangles are represented as `[x1, y1, x2, y2]`

where `(x1, y1)`

is the bottom-left coordinate and `(x2, y2)`

is the top-right coordinate.

Two rectangles overlap if they share any common area.

Return `true`

if the rectangles overlap and `false`

otherwise.

### Examples

`isRectangleOverlap([0,0,3,3], [1,1,4,4]) // true // Why? rec1 and rec2 overlap with the region defined by [1,1,3,3] isRectangleOverlap([-1,-1,2,2], [0,0,3,3]) // true // Why? They have an overlapping area from [0,0] to [2,2] isRectangleOverlap([0,0,2,2], [3,3,5,5]) // false // Why? The rectangles are separated and do not touch or overlap`

Loading...