Fastest algorithm to hop through an array
问题 Start with an array A of positive numbers. Start at index 0. From index i, you can move to index i+x for any x <= A[i]. The goal is to find the minimum number of moves needed to get to the end of the array. Here's an example: { 2 , 4 , 1 , 2 , 3 , 2 , 4 , 2} If you always go as far as possible in each move, then this is what you get: 0 , 2 , 3 , 5 , 7 This takes 4 moves. But you can get through it faster by doing it this way 0 , 1 , 4 , 7 This only takes 3 moves. I thought about this for a