Problem
The rectangular grid bits contains the characters 0 and 1. Return the largest area of an axis-aligned rectangle made entirely of 1 cells.
Such a rectangle consists of consecutive rows and consecutive columns. Its area is the number of cells it contains. Return 0 if there is no 1 cell.
Examples
Example 1
Input: bits = [["1","1","0"],["1","1","1"],["0","1","1"]]
Output: 4
A two-by-two block of 1 cells has area 4; no larger all-1 rectangle exists.
Example 2
Input: bits = [["0","0","0"],["0","0","0"]]
Output: 0
No cell can belong to a positive-area all-1 rectangle.
Constraints
-
The grid has between
1
and
200
rows and between
1
and
200
columns.
-
All rows have the same length.
-
Every cell holds the character
0
or the character
1
.