0391. Perfect Rectangle

https://leetcode.com/problems/perfect-rectangle

Description

Given an array rectangles where rectangles[i] = [xi, yi, ai, bi] represents an axis-aligned rectangle. The bottom-left point of the rectangle is (xi, yi) and the top-right point of it is (ai, bi).

Return true if all the rectangles together form an exact cover of a rectangular region.

Example 1:

Example 2:

Example 3:

Example 4:

Constraints:

  • 1 <= rectangles.length <= 2 * 104

  • rectangles[i].length == 4

  • -105 <= xi, yi, ai, bi <= 105

ac

Last updated

Was this helpful?