题目描述: 自己的提交: class Solution: def countSquares(self, matrix: List[List[int]]) -> int: if not matrix: return 0 m,n = len(matrix),len(matrix[0]) dp = [0] + [0] * m * n for i in range(m): for j in range(n): dp[i*n+j+1] = dp[i*n+j] layer = min(i,j) for l…