matrix holds 0s and 1s. Return the number of square submatrices (of any size) that contain only 1s.
For [[0, 1, 1, 1], [1, 1, 1, 1], [0, 1, 1, 1]] the answer is 15.
Example 1
Input:
count_squares([[0, 1, 1, 1], [1, 1, 1, 1], [0, 1, 1, 1]])
Output:
15
Example 2
Input:
count_squares([[1, 0, 1], [1, 1, 0], [1, 1, 0]])
Output:
7
0 <= rows, cols <= 5000 or 1.No results yet
Run your code to check it against the examples, or submit to run every test.