Maximal Square
Medium
Dynamic Programming
Array
Dynamic Programming
Matrix
Find largest square containing only 1s in binary matrix. Return area.
Constraints
m, n ≤ 300
Examples
Example 1:
Input: 1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Output: 4
Example 2:
Input: 0 1
1 0
Output: 1
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console