2
def isRectangleCover(self, rectangles: List[List[int]]) -> bool:3
X1, Y1 = float("inf"), float("inf")4
X2, Y2 = -float("inf"), -float("inf")8
for x1, y1, x2, y2 in rectangles:9
# calculate the coords of the potential perfect rectangle10
X1, Y1 = min(X1, x1), min(Y1, y1)11
X2, Y2 = max(X2, x2), max(Y2, y2)12
# add up to the actual_area, so we can check against to see if thers is any part overwritten.13
actual_area += (x2 - x1) * (y2 - y1)15
# proving steps in https://labuladong.github.io/algo/4/32/131/16
for p in [(x1, y1), (x1, y2), (x2, y1), (x2, y2)]:23
expected_area = (X2 - X1) * (Y2 - Y1)24
if actual_area != expected_area:30
if (X1, Y1) not in points:32
if (X1, Y2) not in points:34
if (X2, Y1) not in points:36
if (X2, Y2) not in points: