I don't understand why this gives 3, and not 5.

Input:

[[0,1,1,0],

[0,1,1,0],

[0,0,0,1]]

Output: 3

The 5 consecutive ones comes as:

(0, 2) -> (0, 1) -> (1, 1) -> (1, 2) -> (2, 3)

Can anyone help to point out what's wrong with my understanding?

Thanks!