Open cjql opened 4 years ago
class Solution: def countSquares(self, matrix: List[List[int]]) -> int: for i in range(1,len(matrix)): for j in range(1,len(matrix[0])): matrix[i][j] *= min(matrix[i-1][j],matrix[i][j-1],matrix[i-1][j-1])+1 return sum(map(sum,matrix))
C++
Java
Python
C
C
JavaScript
Ruby
Swift
Go
Scala
Kotlin
Rust
PHP