[[4,1,1,3,1,1,1]] shouldn't this be 3? test case answer expected is 2?


  • 0

    [[4,1,1,3,1,1,1]] shouldn't this be 3? test case answer expected is 2?


  • 3
    C

    Yeah, it's 2.

    Each element in the array represents your maximum jump length at that
    position.

    It means that at the first element, you can jump from element 4 to element 1 or 1 or 3 or 1.

    It takes you one step to jump from 4 to 3, and another step to jump from 3 to the 1 at the end.


Log in to reply
 

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