Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
reduce(set.union, points) solution in Clear category for Rectangles Union by flpo
from typing import List, Tuple
from functools import reduce
from itertools import product
def rectangles_union(recs: List[Tuple[int]]) -> int:
points = (product(range(x0, x1), range(y0, y1)) for x0, y0, x1, y1 in recs)
return len(reduce(set.union, points, set()))
Oct. 20, 2018
Comments: