AlgoMaster Logo

Count Square Submatrices with All Ones

matrix=[[0,1,1,1],[1,1,1,1],[0,1,1,1]]
0 / 76
algomaster.io
Step:Count every all-1s square. Anchor a square at each 1 and grow it while every cell stays a 1