Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

Design a rectangular board with width columns and height rows. The board is initially empty. Coordinates are zero-indexed: in (x, y), x is the column and y is the row. Each rectangle is defined by its top-left corner (x1, y1) and bottom-right corner (x2, y2), including every cell on its boundaries.

Rectangles may overlap. At a cell covered by multiple active rectangles, the one added most recently appears on top. Each addition receives the next positive rectangle ID, starting at 1. An ID is never reused, even after its rectangle is removed.

Implement the RectangleBoard class:

Test Cases
Input
Output
Expected