221-MaximalSquare
1 | Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. |
解题思路
可以想到当前节点如果能作为最大的正方形+1,那他上面一定是一个正方形,且形成的正方形,包含其上左右三个点,
所以以该点为底点的变成应该是上左右三点变长+1,dp如下
1 | func maximalSquare(matrix [][]byte) int { |