Ctrl K

Biggest Solid Panel Block

Hard
An LED board is given as a grid panel: each cell is the string "1" if that pixel works and is lit, or "0" if it has gone dark. A designer wants to show a picture in a rectangular area where **every** pixel is lit. Return the area (number of cells) of the largest such rectangle whose sides follow the rows and columns of the board. If no pixel is lit, return 0.
Example 1
panel=[['1', '1', '0', '1'], ['1', '1', '1', '1'], ['0', '1', '1', '1']] → 6

The largest fully lit rectangle covers columns 1–3 in rows 1–2 (0-based): 2 × 3 = 6 pixels.

Example 2
panel=[['0', '0'], ['0', '0']] → 0

No pixel is lit, so the answer is 0.

Example 3
panel=[['1', '0', '1', '1', '1']] → 3

With a single row, the best block is the run of three lit pixels.

Constraints
  • 1 ≤ len(panel), len(panel[i]) ≤ 500
  • All rows have the same length
  • panel[i][j] is "0" or "1"
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsLong Leaps Across a Board HardAll-Ones Rectangles MediumWater Between Walls HardFrog on the Posts HardRaising by Ranges Hard
loading Python…
Input
panel=[['1', '1', '0', '1'], ['1', '1', '1', '1'], ['0', '1', '1', '1']]
Expected
6

Run checks the first 3 tests in your browser. Submit checks all 69 tests on the server, hidden ones included.