Do not understand the problem description. Can anyone help?


  • 0
    P

    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!


  • 0
    C

    Consider ur input as a 4x4 box, and see how u can draw a longest straight line. In ur case it would be "(0, 1) -> (1, 1) -> (1, 2)"


  • 0
    P

    @chanderiya It is a 3 * 4 box. Why (0,2) and (2, 3) are not counted?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.