221. Maximal Square

Practice Maximal Square for free on NudgeCode: Medium, Dynamic Programming pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

matrix is an m x n grid of "0" and "1". Find the largest square made only of "1" cells and return its area.

Example

matrix = [["1","0","1","0","0"],
          ["1","0","1","1","1"],
          ["1","1","1","1","1"],
          ["1","0","0","1","0"]]  ->  4

Constraints