PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Uber

Find shortest jumps in circular array

Last updated: Mar 29, 2026

Quick Overview

This question evaluates graph-traversal and modular arithmetic skills by requiring modeling a circular array as a state graph and determining reachability and minimum-distance jumps under wrap-around constraints.

  • medium
  • Uber
  • Coding & Algorithms
  • Software Engineer

Find shortest jumps in circular array

Company: Uber

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a circular array `arr` of length `n`. From index `i`, you may jump exactly `arr[i]` steps either to the left or to the right (wrapping around the array), i.e. you can move to: - `(i + arr[i]) mod n` - `(i - arr[i]) mod n` Given two indices `start` and `target` (0-based), return the minimum number of jumps needed to reach `target` starting from `start`. If it is impossible to reach `target`, return `-1`. Clarifications: - Each jump uses the value at your current index to determine the exact jump distance. - The array is circular, so indices wrap around using modulo `n`. Example: - `arr = [2, 1, 2, 3]`, `start = 0`, `target = 3` - From 0 you can go to 2 (right) or 2 (left) → 2 - From 2 you can go to 0 or 0 → cannot reach 3 → return `-1`. Implement a function to compute this minimum jump count.

Quick Answer: This question evaluates graph-traversal and modular arithmetic skills by requiring modeling a circular array as a state graph and determining reachability and minimum-distance jumps under wrap-around constraints.

Related Interview Questions

  • Implement Minesweeper and Word Search - Uber (medium)
  • Implement Store Autocomplete - Uber (medium)
  • Implement Cache Eviction And Seat Assignment - Uber (medium)
  • Schedule Non-Overlapping Meetings Efficiently - Uber (hard)
  • Evaluate an Arithmetic Expression - Uber
Uber logo
Uber
Jan 28, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
7
0

You are given a circular array arr of length n. From index i, you may jump exactly arr[i] steps either to the left or to the right (wrapping around the array), i.e. you can move to:

  • (i + arr[i]) mod n
  • (i - arr[i]) mod n

Given two indices start and target (0-based), return the minimum number of jumps needed to reach target starting from start. If it is impossible to reach target, return -1.

Clarifications:

  • Each jump uses the value at your current index to determine the exact jump distance.
  • The array is circular, so indices wrap around using modulo n .

Example:

  • arr = [2, 1, 2, 3] , start = 0 , target = 3
    • From 0 you can go to 2 (right) or 2 (left) → 2
    • From 2 you can go to 0 or 0 → cannot reach 3 → return -1 .

Implement a function to compute this minimum jump count.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Uber•More Software Engineer•Uber Software Engineer•Uber Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.