1 minute to read - Apr 12, 2023

Generate a programmer puzzle

Give me one of those microsoft-style interview questions. The ones that are puzzles.

Sure! Here is a puzzle question for you:

You are given a list of integers, where each element represents the maximum number of steps that can be jumped going forward from that element. Write a function to return the minimum number of jumps you must take in order to get from the start to the end of the list.

For example, given `[6, 2, 4, 0, 5, 1, 1, 4, 2, 9]`, you should return 2, as the optimal solution involves jumping from `1` to `5`, and then from `5` to `9`.

Note that you can not jump outside the list or move backwards.

Can you solve this puzzle?

loading...