← 返回 salesforce 的题目列表Maximal Rectangle
类型:online_judge
Maximal Rectangle
Given an m × n binary matrix containing '0' and '1', find the largest rectangle containing only '1's and return its area.
Explain the reduction to Largest Rectangle in Histogram and implement a monotonic-stack solution.
Constraints
1 <= m, n <= 200
matrix[i][j] is either '0' or '1'.
Example
Input
4 5
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Output
6