FastPrepMinimum Jumps to Reach the End
Problems/Minimum Jumps to Reach the End

Minimum Jumps to Reach the End

Nutanix logoNutanix● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: An intern candidate described a two-question Nutanix online assessment. It was taken with the camera and microphone on, and was due within 10 days of applying. For this question they wrote no statement. They only said it is a simpler take on a frog-jump problem, plus a coded problem number. We read that, with moderate confidence, as the classic exercise of reaching the end of an array in the fewest jumps.

The report gives no rules, limits or examples. Here each value is the longest forward jump allowed from that index, and any shorter forward jump is also allowed. You start at index 0. The input always lets you reach the last index. You return the fewest jumps (0 for a single element). The limits (up to 10^4 values, each from 0 to 100) and the examples are ours.

Our version is about 75% the same as the reported question.

You are given an integer array nums of length n. You start on index 0. From index i you can jump forward to any index j with i < j <= i + nums[i], as long as j is inside the array. So a jump may be shorter than nums[i], and if nums[i] is 0 you cannot jump from index i at all.

Return the fewest jumps needed to land on the last index, n - 1. The input is chosen so that the last index can always be reached. If n is 1, you already stand on the last index and the answer is 0.

Function

minJumps(nums: int[]) → int

Examples

Example 1

nums = [2,4,1,1,1,1]return = 2

From index 0 (value 2) you can jump to index 1 or 2. Jump to index 1: its value 4 reaches index 5, the last index. That is 2 jumps: 0 → 1 → 5.

One jump is not enough, because index 0 reaches at most index 2. Jumping the full length to index 2 would be a poor choice: it holds a 1, and from there you need 3 more jumps (2 → 3 → 4 → 5).

Example 2

nums = [2,3,0,1,4,0,0,0]return = 3

The last index is 7. A best path is 0 → 1 → 4 → 7. Index 2 holds 0, so landing there is a dead end. From index 1 (value 3) you can reach index 2, 3 or 4; jump to 4. Its value 4 allows a jump of up to 4 steps, and a jump may be shorter, so a jump of 3 steps lands on index 7.

Two jumps are not enough: after one jump you stand on index 1 or 2, and from those the farthest you can reach is index 1 + 3 = 4. So the answer is 3.

Example 3

nums = [6]return = 0

The array has one element, so you start on the last index. No jump is needed, so the answer is 0, whatever the value is.

Constraints

  • 1 <= nums.length <= 10^4
  • 0 <= nums[i] <= 100
  • The last index can be reached from index 0.

More Nutanix Online Assessment questions

  • Good SubsequencesOA · Seen Jul 2026
  • Min Cost to Connect All PointsOA · Seen Jun 2026
  • Digit Changes for a Multiple of 9OA · Seen Aug 2025
  • Gas Station Loop StartOA · Seen Aug 2025
  • Number of Players (for MTS2)OA · Seen Oct 2024
  • Work Schedules (for MTS2)OA · Seen Oct 2024
  • Minimum Operations to Convert ArrayOA · Seen Apr 2024
  • No Adjacent CharactersOA · Seen Apr 2024
  • Build a BST From a ListOA · Seen Nov 2022
  • Delete Even-Valued Nodes From a Linked ListOA · Seen Nov 2022

Similar questions at other companies

  • Maximum Even-Sum Neighboring PairsDRW · OADRW interview questions
  • Minimize Total Input Cost (for LTMS)Salesforce · OASalesforce interview questions
  • Maximize Protected City PopulationAmazon · OA
  • Network FormationPalantir · OAPalantir interview questions
  • Maximum Even Subsequence SumExpedia · OAExpedia interview questions
  • Maximum Even-Sum Adjacent Pairs in a Circular ArrayTesla · OATesla interview questions
  • Fewest Fountains to Water the GardenDocuSign · OADocuSign interview questions
  • Split Array to Minimize the Largest SumInfosys · OAInfosys interview questions
  • Split Array Largest SumAuxoAI · OA
  • Maximum Income from Asset TradingJefferies · OA

Interview reports that mention this question

  • Nutanix SWE Intern OA Questions: 16 Experiences (Part 2 of 3)
  • Nutanix U.S. SWE Intern Interviews: 54 Experiences (Part 1 of 3)

Nutanix interview experiences

  • Nutanix SWE Intern Phone Screens: 20 Experiences (Part 3 of 3)
  • Nutanix SWE OA and Interviews, Level Not Reported: 9 Experiences
  • Nutanix Intern Debugging Round and Interviews: 25 Experiences
All Nutanix interview questionsSee Nutanix hiring insights
Saved
class Solution {
    public int minJumps(int[] nums) {
        // Write your code here.
    }
}
Checking account…