Class Solution
-
- All Implemented Interfaces:
public final class Solution
391 - Perfect Rectangle.
Hard
Given an array
rectangles
where <code>rectanglesi = x<sub>i</sub>, y<sub>i</sub>, a<sub>i</sub>, b<sub>i</sub></code> represents an axis-aligned rectangle. The bottom-left point of the rectangle is <code>(x<sub>i</sub>, y<sub>i</sub>)</code> and the top-right point of it is <code>(a<sub>i</sub>, b<sub>i</sub>)</code>.Return
true
if all the rectangles together form an exact cover of a rectangular region.Example 1:
Input: rectangles = \[\[1,1,3,3],3,1,4,2,3,2,4,4,1,3,2,4,2,3,3,4]
Output: true
Explanation: All 5 rectangles together form an exact cover of a rectangular region.
Example 2:
Input: rectangles = \[\[1,1,2,3],1,3,2,4,3,1,4,2,3,2,4,4]
Output: false
Explanation: Because there is a gap between the two rectangular regions.
Example 3:
Input: rectangles = \[\[1,1,3,3],3,1,4,2,1,3,2,4,2,2,4,4]
Output: false
Explanation: Because two of the rectangles overlap with each other.
Constraints:
<code>1 <= rectangles.length <= 2 * 10<sup>4</sup></code>
rectangles[i].length == 4
<code>-10<sup>5</sup><= x<sub>i</sub>, y<sub>i</sub>, a<sub>i</sub>, b<sub>i</sub><= 10<sup>5</sup></code>
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final Boolean
isRectangleCover(Array<IntArray> rectangles)
-
-
Method Detail
-
isRectangleCover
final Boolean isRectangleCover(Array<IntArray> rectangles)
-
-
-
-