FastPrepMinimum Jumps with Parity-Restricted Jump Lengths
Problems/Minimum Jumps with Parity-Restricted Jump Lengths

Minimum Jumps with Parity-Restricted Jump Lengths

Google logoGoogle● HardNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names Jump Game II and adds that odd-numbered jumps must have odd length, while even-numbered jumps must have even length. We number jumps from one and fix the output for unreachable. Our version is about 91% the same as the reported question.

You are given a non-negative array nums. From index i, you may jump forward by any length from 1 through nums[i].

Jump numbers are one-based: the first jump must have odd length, the second jump even length, the third odd, and so on. Return the minimum jumps needed to reach the last index, or -1 if impossible.

An array of length one requires zero jumps.

Function

minimumParityJumps(nums: int[]) → int

Examples

Example 1

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

Use jump lengths 1, 2, and 1 to reach indices 1, 3, and 4.

Example 2

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

No parity-respecting sequence reaches the final index.

Example 3

nums = [0]return = 0

The start is already the destination.

Constraints

  • 1 <= nums.length <= 5000.
  • 0 <= nums[i] <= nums.length.

More Google Onsite Interview questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Coin ChangeMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Coin ChangeKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Coin ChangePinterest · ONSITE INTERVIEWPinterest interview questions
  • Coin ChangeBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Path Through an O/X Grid Using Only Right and DownAmazon · PHONE SCREEN
  • Fewest Jumps to the End or StuckAdobe · PHONE SCREENAdobe interview questions
  • Coin ChangeGrubhub · PHONE SCREENGrubhub interview questions
  • Largest Diamond of Ones in a GridRippling · PHONE SCREENRippling interview questions
  • Global Charger AssignmentSpotify · ONSITE INTERVIEW
  • Minimum Taps to Water a GardenThe D.E. Shaw Group · ONSITE INTERVIEWThe D.E. Shaw Group interview questions

Interview reports that mention this question

  • Google Early Career SWE Offer: 1 Experience

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int minimumParityJumps(int[] nums) {
        // Write your code here.
    }
}
Checking account…