Maximal Rectangle

hard
1. Given a rows x cols binary matrix filled with 0's and 1's.
2. Find the largest rectangle containing only 1's and return its area.

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1. 1 <= row, cols <= 200
2. matrix[i][j] is 0 or 1.

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
2
5
10100
10111
Output
3
Previous
Largest Area Histogram 2
Next
Trapping Rain Water

Related Questions