Rectangle Area II
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given a list of axis-aligned rectangles. Each entry rectangles[i] = [x1, y1, x2, y2] gives the bottom-left corner (x1, y1) and the top-right corner (x2, y2) of one rectangle.
Compute the total area of the plane covered by **at least one** rectangle. Regions where rectangles overlap are counted only once.
Coordinates can be as large as 10^9, so the area can overflow; return it modulo 1_000_000_007.
Examples
Constraints
- 1 <= rectangles.length <= 200
- rectangles[i].length == 4
- 0 <= x1 < x2 <= 10^9
- 0 <= y1 < y2 <= 10^9
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.