Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
4-liner: How many squares in a set of squares! solution in Clear category for Rectangles Union by Stensen
from itertools import product
def rectangles_union(rects):
return len({ square for (x1, y1, x2, y2) in rects \
for square in product(range(x1, x2), range(y1, y2), repeat=1) })
Nov. 18, 2020
Comments: