Fewest jumps to the last tile
You stand on the first tile of a row. jumps[i] is the longest jump forward you may take from tile i; any shorter jump is allowed too. Return the fewest jumps that land you on the last tile, or -1 if no sequence of jumps gets there.
jumps has at least one tile and its values are non-negative. Aim for one pass and O(1) extra space.
Besides the tests, one large input (6,000 tiles) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
fewest_jumps([2,3,0,1,4])→2fewest_jumps([1,1,1,1])→3fewest_jumps([2,1,0,3])→-1