A frog stands on the first of a row of stones. The array nums tells how far it can jump from each stone: if nums[i] = 3, from stone i it can jump forward by 1, 2 or 3 stones.
Return true if the frog can reach the last stone. Otherwise return false.
Examples
Example 1:
Input: nums = [4,1,0,0,2,0]
Output: true
Explanation: Jump 4 steps from the first stone to the stone with 2, then 1 step to the last stone.
Example 2:
Input: nums = [2,1,0,3]
Output: false
Explanation: Every path ends at the third stone, which has 0, so the last stone cannot be reached.
Example 3:
Input: nums = [3,0,0,0]
Output: true
Explanation: One jump of 3 steps reaches the last stone. The stones in between have 0, but the frog never stands on them.