# Count Square Submatrices

Let's solve the Count Square Submatrices problem using Dynamic Programming.

## Statement

Given a matrix containing only ones and zeros, count the total number of square submatrices that contain only ones.

If the matrix is empty, then return 0.

**Constraints**:

- $1 <=$
`matrix.length`

$<= 200$ - $1 <=$
`matrix[i].length`

$<= 200$ `matrix[i][j]`

is either $0$ or $1$

## Examples

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.