← 返回 salesforce 的题目列表Maximal Square
类型:online_judge
Maximal Square
Given an m × n binary matrix matrix containing characters '0' and '1', find the largest square containing only '1's and return its area.
Example
Input:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Output: 4
Constraints
1 <= m, n <= 300
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
4