Why the frog could jump 2 units twice in the example?


  • 1
    S

    [0,1,3,5,6,8,12,17]

    There are a total of 8 stones.
    The first stone at the 0th unit, second stone at the 1st unit,
    third stone at the 3rd unit, and so on...
    The last stone at the 17th unit.

    Return true. The frog can jump to the last stone by jumping
    1 unit to the 2nd stone, then 2 units to the 3rd stone, then 2 units to the 4th stone, then 3 units to the 6th stone,
    4 units to the 7th stone, and 5 units to the 8th stone.

    the question describes If the frog's last jump was k units, then its next jump must be either k - 1, k, or k + 1 units., but in the demo ,the frog dump 2 units followed by another 2 units, is that jump valid?


Log in to reply
 

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