Trains the technique from
LeetCode 85Maximal RectangleThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A scanner inspects a sheet of veneer cell by cell and hands you the reading as panel, a grid of one-character strings. panel[i][j] is "1" when that cell of the sheet is flawless and "0" when the scanner found a blemish there. Every row of the reading has the same length.
A cutting machine can punch out one axis-aligned block of cells: pick a run of consecutive rows and a run of consecutive columns, and the block is every cell where the two runs meet. The block is sellable only if every cell inside it is flawless.
Return the number of cells in the biggest sellable block. If the sheet has no flawless cell at all, return 0.
Example 1
Columns 1 and 2 are flawless down all four rows, giving a 4-by-2 block of 8 cells. The two middle rows offer a 2-by-4 block, also 8, and nothing larger exists because the corners are blemished.
Example 2
Nothing is blemished, so the machine punches out the whole sheet.
Example 3
Every cell carries a blemish, so no block can be sold.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def largest_flawless_panel(panel: list[list[str]]) -> int:public int largestFlawlessPanel(char[][] panel)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.