[x1, y1, x2, y2], where (x1, y1) is its bottom-left corner and (x2, y2) its top-right corner.
You get two such rectangles, first and second. Return True if they share a region of positive area, and False otherwise. Rectangles that only touch at an edge or a corner do not overlap.first=[0, 0, 4, 3], second=[2, 1, 6, 5] → True
They share the rectangle from (2, 1) to (4, 3), whose area is 4.
first=[0, 0, 2, 2], second=[2, 0, 4, 2] → False
The rectangles only touch along the edge x = 2, so the shared area is zero.
first=[0, 0, 4, 3], second=[2, 1, 6, 5]
True
Run checks the first 3 tests in your browser. Submit checks all 119 tests on the server, hidden ones included.