grid of 0s and 1s. Count the axis-aligned rectangular blocks in it whose cells are **all** 1.
Blocks with different boundaries count separately, even if one lies inside another.grid=[[1, 1], [1, 0]] → 5
Three 1×1 cells, one 1×2 strip in the top row and one 2×1 strip in the left column: 5 in total.
grid=[[1, 1, 1]] → 6
Three cells, two strips of length 2 and one of length 3: 6 rectangles.
grid=[[0, 1], [1, 1]] → 5
grid=[[1, 1], [1, 0]]
5
Run checks the first 3 tests in your browser. Submit checks all 93 tests on the server, hidden ones included.