Medium · Dynamic Programming
Maximal Square
Given an m × n binary matrix filled with the characters '0' and '1', return the area of the largest square that contains only '1's.
Examples
Example 1
{
"matrix": [
["1", "0", "1", "0", "0"],
["1", "0", "1", "1", "1"],
["1", "1", "1", "1", "1"],
["1", "0", "0", "1", "0"]
]
}Output: area 4
Example 2
{
"matrix": [
["1", "1"],
["1", "1"]
]
}Output: area 4
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.