FastPrepFewest Jumps to the End of an Array
Problems/Fewest Jumps to the End of an Array

Fewest Jumps to the End of an Array

Rippling logoRippling● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Our version returns -1 when the last index is out of reach, counts 0 jumps for a one-item array, and treats each value as the longest jump allowed from that index. The limits and the examples are also ours.

A review for a Software Development Engineer role in New Delhi, dated only to August 2021, lists this task in a live coding round over Zoom.

The review gives the goal (the fewest jumps to the final index), tags it as dynamic programming, and says code had to handle corner cases. It does not define the jump rule, give limits or examples, or say what to return when the end cannot be reached.

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

You stand at index 0 of an integer array nums. nums[i] is the longest jump you can make from index i: from i you may jump to any index from i + 1 up to i + nums[i], as long as it is inside the array. A value of 0 means you cannot move from that index.

Return the fewest jumps needed to land on the last index, nums.length - 1. If the last index cannot be reached, return -1.

Function

jump(nums: int[]) → int

Examples

Example 1

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

From index 0 you can reach indices 1 to 3. The best of those is index 2, which reaches up to index 6. From index 6 one more jump reaches index 7. That is 3 jumps (0 to 2 to 6 to 7). Two jumps are not enough: from indices 1, 2 and 3 the farthest you can get is index 6.

Example 2

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

From index 0 you can reach index 1 or 2. Index 1 only reaches index 2, and index 2 holds 0, so you are stuck. Index 3 cannot be reached: return -1.

Example 3

nums = [0]return = 0

You already stand on the last index, so you need 0 jumps.

Constraints

  • 1 <= nums.length <= 10000
  • 0 <= nums[i] <= 1000

More Rippling Phone Screen questions

  • Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
  • Delivery Cost Tracker with Effective-Dated RatesPHONE SCREEN · Seen Nov 2026
  • Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best and Worst Camel Card CompletionsPHONE SCREEN · Seen Nov 2026
  • Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • In-Memory Priority Task SchedulerPHONE SCREEN · Seen Oct 2026
  • Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Median Across N Sorted ArraysPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Jump GamePaytm · PHONE SCREENPaytm interview questions
  • Minimum Cost for a Target WeightPace Stock Broking Services · PHONE SCREEN
  • Jump Game IINavi · PHONE SCREEN
  • Best Stock Profit With a Sell FeeKaseya · PHONE SCREEN
  • Fewest Jumps to the End or StuckAdobe · PHONE SCREENAdobe interview questions
  • Return a Minimum-Coin Change BreakdownDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Most Relevant Text SpanHebbia · PHONE SCREEN
  • Split Array to Minimize the Largest SumNation with NaMo · PHONE SCREEN
  • Best Time to Buy and Sell StockOracle · PHONE SCREEN · ONSITE INTERVIEWOracle interview questions
  • Best Time to Buy and Sell StockJP Morgan Chase · PHONE SCREENJP Morgan Chase interview questions

Interview reports that mention this question

  • Rippling New Grad SDE Interviews: 11 Experiences

Rippling interview experiences

  • Rippling No-Level Older Reports: 31 Experiences (Part 6 of 6)
  • Rippling No-Level Onsite Loops: 24 Experiences (Part 5 of 6)
  • Rippling No-Level Screens and Loops: 18 Experiences (Part 4 of 6)
  • Rippling No-Level Coding Screens: 37 Experiences (Part 3 of 6)
  • Rippling No-Level Design, Screens: 30 Experiences (Part 2 of 6)
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public int jump(int[] nums) {
        // Write your code here.
    }
}
Checking account…