Approach hintTry it first, then revealHide
Let dp[i][j] be the side of the largest all-ones square whose bottom-right corner is (i, j). It is limited by the squares ending at the top, left and top-left neighbours.
Let dp[i][j] be the side of the largest all-ones square whose bottom-right corner is (i, j). It is limited by the squares ending at the top, left and top-left neighbours.