Why the second example can not the reach the final stone?


  • 0
    This post is deleted!

  • 0
    T

    The available jumps are (k-1, k, k+1) where k is the length of the last jump, not how many jumps you did. So in the third line of your explanation :

    "then jump 1 units to the 5th stone(4), 3 jumps, possible next jump is 2, 3, 4;"

    It should instead be :

    then jump 1 units to the 5th stone(4), 3 jumps, possible next jump is 0, 1, 2;

    And from there you can see why it doesn't work with the second example


  • 0

    Thanks a lot~


Log in to reply
 

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