Given an array of strictly positive integers, start from the first element and reach the last by jumping. The jump length can be at most the value at the current position in the array. The optimal result is when you reach the goal in minimum number of jumps.

Assignment

Write a function steps that takes a array (a list or a tuple) of strictly positive integers. The function must return a list that defines an optimal path to reach the end of the sequence starting from the leftmost position in the array. From each cell you can only jump forward with a step size that is at most the value at the current position in the array.

Example

>>> steps([1, 1, 1, 1])
[0, 1, 2, 3]
>>> steps([1, 2, 1, 1])
[0, 1, 3]
>>> steps([5, 2, 1, 1])
[0, 3]
>>> steps([5])
[0]
>>> steps([1, 2, 3, 4, 1, 12, 2, 3, 5, 6, 6, 7, 2, 1, 4, 2, 5, 4, 1, 1])
[0, 1, 2, 5, 16, 19]