You are given a list of axis-aligned rectangles, where each rectangle is represented as
[x1, y1, x2, y2], describing its bottom-left corner (x1, y1) and top-right corner (x2, y2).
Your task is to determine whether all these rectangles fit together perfectly to form one single large rectangle, without any gaps or overlapping regions.
If they combine to make an exact rectangular region, return true; otherwise return false.
Input: rectangles = [[0,0,2,2],[2,0,3,1],[2,1,3,2],[0,2,1,3],[1,2,3,3]]
Output: true
Explanation:
All small rectangles join to form one clean 3×3 rectangle.
Input: rectangles = [[0,0,1,2],[0,2,1,3],[1,0,3,2]]
Output: false
Explanation:
There is an empty region on the top-right area.
Input: rectangles = [[1,1,3,3],[2,2,4,4]]
Output: false
Explanation:
Overlapping happens between the two rectangles.
Accepted:
Submission: