Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Bruteforce with set solution in Clear category for Rectangles Union by swagg010164
from typing import List, Tuple
def rectangles_union(recs: List[Tuple[int]]) -> int:
squares = set()
for rect in recs:
x1, y1, x2, y2 = rect
for i in range(y1, y2):
for j in range(x1, x2):
squares.add((i, j))
return len(squares)
July 18, 2021
Comments: