AI Features

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.

Example

Consider the input matrix given below. We have a total of 77 square submatrices with all ones, including 66 ...