1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
Starting at index 0, for an element n at index i,
you are allowed to jump at most n indexes ahead.
Given a list of numbers, find the minimum number of jumps to reach the end of
the list.
Example:
Input: [3, 2, 5, 1, 1, 9, 3, 4]
Output: 2
Explanation:
The minimum number of jumps to get to the end of the list is 2:
3 -> 5 -> 4
Here's a starting point:
```python
def jumpToEnd(nums):
# Fill this in.
print jumpToEnd([3, 2, 5, 1, 1, 9, 3, 4])
# 2
``
|