Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 349 Bytes

README.md

File metadata and controls

17 lines (11 loc) · 349 Bytes

Jump to the end

This problem was asked by Facebook.

Description

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:
  Input: [3, 2, 5, 1, 1, 9, 3, 4]
  Output: 2 (3 -> 5 -> 4)