R3-分治篇 class Solution:def countSquares(self, matrix: List[List[int]]) -> int:rowlen(matrix)collen(matrix[0])dp[[0]*(col1) for _ in range(row1)]ret0for i in range(row):for j in range(col):if matrix[i][j]1:dp[i1][j1]min(dp[i][j1],dp[i1][j],dp[i][j])1re…