Suppose you have a stack of sticky notes scattered across a table, some overlapping. You want to know the total table area they cover — not the sum of their individual areas, but the net covered area after accounting for every overlap.
That is Klee's measure problem, posed by Victor Klee in 1977. The input is a list of n axis-aligned rectangles, possibly overlapping. The output is a single number: the total area of their union.
The naive approach — summing all rectangle areas and then subtracting overlaps — runs into an inclusion-exclusion nightmare with up to terms. Yet the problem is solved, and solved beautifully: a sweepline algorithm computes the answer in time. The key insight is to drag an imaginary vertical line across the plane and maintain, as the line moves, exactly how much of it is currently covered by some rectangle.
This is not just an abstract puzzle. Klee's problem shows up in circuit design, database query planning, computer graphics, and anywhere that areas of influence overlap.
Comments
Loading comments...