Data Structures & AlgorithmsHard

Starting at index 0 of 2 3 1 1 4 2 3 1 1 4, a value a[i] lets you jump from index i to any index in i+1 … i+a[i]. What is the minimum number of jumps needed to reach the LAST index?

  1. A. 5
  2. B. 13
  3. C. 3
  4. D. 4

Correct answer: D. 4

Track the furthest index reachable within the current number of jumps; when you reach the boundary of the current level, the count goes up by one. A +1 on top of the level count, or reporting the furthest index itself, misreads the rule.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic