Count Square Submatrices

Given a matrix containing only ones and zeros, return the count of square submatrices with all ones.

Statement

Given an N ∗ M matrix containing only ones and zeros, count the total number of square submatrices that contain only 1’s.

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