grid with m rows and n columns; each cell is the string '1' or '0'.
Find the largest square, aligned with the grid lines, whose cells are all '1', and return its area (the number of cells). If there are no ones, the answer is 0.grid=[['1', '1', '1', '0'], ['1', '1', '1', '1'], ['1', '1', '1', '1'], ['0', '1', '1', '0']] → 9
The top-left 3 × 3 square is all ones, area 9. There is no all-ones 4 × 4 square.
grid=[['0', '1', '0'], ['1', '0', '1']] → 1
The ones stand alone, so the best square is 1 × 1.
grid=[['0', '0']] → 0
grid=[['1', '1', '1', '0'], ['1', '1', '1', '1'], ['1', '1', '1', '1'], ['0', '1', '1', '0']]
9
Run checks the first 3 tests in your browser. Submit checks all 71 tests on the server, hidden ones included.