Largest free region
A data centre floor is a width by height rectangle of one metre cells, with x running from 0 to width-1 and y from 0 to height-1. Racks arrive as a list of four integer rows x1, y1, x2, y2, and a rack occupies every cell with x1 <= x <= x2 and y1 <= y <= y2. Footprints may overlap and always sit inside the floor. A trolley rolls between orthogonally adjacent free cells, so free cells that touch edge to edge belong to the same region. Return the number of cells in the largest connected region of free cells, or 0 when the floor has no free cell at all. width and height reach one million, so nothing that touches every cell can finish, but there are at most 200 racks.
floor_open_area(width: int, height: int, racks: list[list[int]]) → int[8,6,[[2,0,2,4],[5,2,6,5]]]out35[4,4,[]]out16[6,6,[[0,2,5,3],[2,0,3,5]]]out4State 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.
[8,6,[[2,0,2,4],[5,2,6,5]]]35not run yetsample[4,4,[]]16not run yetsample[6,6,[[0,2,5,3],[2,0,3,5]]]4not run yetsample