Largest All-Ones Square — Solution & Editorial
dp[i][j] = side of the largest square with bottom-right corner here = 1 + min(top, left, diagonal) when the cell is 1.
Complexity: O(NM)
dp[i][j] = side of the largest square with bottom-right corner here = 1 + min(top, left, diagonal) when the cell is 1.
Complexity: O(NM)