184. Maximal Square

Given a binary matrix of 0s and 1s. Find the area of the largest square consisting only of ones.
Example 1
Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]
Output: 4
Explanation: Maximum square is 2×2, area = 4.
Example 2
Input: matrix = [["0","1"],["1","0"]]
Output: 1
Explanation: The only 1 is a 1×1 square.
arraysdynamic programmingmedium
JavaScript
Loading...
Line 1, Char 1