Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Rectangles Union by tokiojapan55
from typing import List, Tuple
def rectangles_union(recs: List[Tuple[int]]) -> int:
from functools import reduce
area = lambda r: {(x,y) for x in range(r[0],r[2]) for y in range(r[1],r[3])}
return len(reduce(lambda a,r: a|area(r), recs, set()))
April 17, 2020
Comments: