LeetCode forty-fifth title - jump game

Jump Game II

Problem description: This is a jumping game, the rules are given by a non-negative integer array, the very beginning is at 0, the maximum value represents the array element of the array can skip the first index that is required by the smallest number of hops reached the final of the array index

For example:

Input: [2,3,1,1,4]

Output: 2

Explanation: The minimum skip value of the array 2 is, at the first hop from an index 1 to index 0, the second jump to the end of the 3

Solution one:

When the length of the array that is not a skip, the result is 0, the rightmost find values ​​for each point can be achieved, determines

White brush the question of road, please enlighten - - either a late bloomer, or go down the drain

Guess you like

Origin www.cnblogs.com/lalalaczq/p/10963939.html