[2,5,0,0]?


  • 0
    C

    The test for [2,5,0,0] shows that the expected output is true ~ I'd appreciate some clarity as to why. Starting at 2 (nums[0]), we jump to 0 (nums[2]). The final index at nums[3] cannot be reached jumping zero spaces.


  • 0
    H

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

    So start at 2(nums[0]), we can jump 1 step to 5(nums[1]), then jump 2 step to last index.

    Keyword: Maximum


Log in to reply
 

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