Question
Given a list of axis-aligned rectangles each as [x1, y1, x2, y2] (lower-left and upper-right corners, x1<x2, y1<y2), compute the total area covered by their union. Overlapping area is counted once. Use coordinate compression plus a sweep so the answer is exact. Return the area modulo 1000000007 (the raw union area can be large). There are up to 200 rectangles and coordinates fit in 32-bit ints.
rectangle_union_area(rectangles: list[list[int]]) → int[[[0,0,2,2],[1,1,3,3]]]out7State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.