PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Uber

Count paths with prime-ending jumps

Last updated: Apr 6, 2026

Quick Overview

This question evaluates a candidate's ability to design and implement dynamic programming for counting paths, combining combinatorial reasoning with modular arithmetic and handling step-size constraints tied to primes ending in digit 3.

  • medium
  • Uber
  • Coding & Algorithms
  • Software Engineer

Count paths with prime-ending jumps

Company: Uber

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Take-home Project

You are given an integer `n` representing the top of a staircase, where you start at step `0` and want to land exactly on step `n`. In one move, you may jump: - exactly `1` step, or - any prime number of steps whose decimal representation ends with the digit `3` (for example: `3`, `13`, `23`, `43`). Count how many distinct sequences of jumps allow you to reach step `n` exactly. Since the answer can be large, return it modulo `1,000,000,007`. A dynamic programming solution is expected. You may assume `1 <= n <= 100000`.

Quick Answer: This question evaluates a candidate's ability to design and implement dynamic programming for counting paths, combining combinatorial reasoning with modular arithmetic and handling step-size constraints tied to primes ending in digit 3.

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 15, 2026, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
1
0

You are given an integer n representing the top of a staircase, where you start at step 0 and want to land exactly on step n.

In one move, you may jump:

  • exactly 1 step, or
  • any prime number of steps whose decimal representation ends with the digit 3 (for example: 3 , 13 , 23 , 43 ).

Count how many distinct sequences of jumps allow you to reach step n exactly. Since the answer can be large, return it modulo 1,000,000,007.

A dynamic programming solution is expected. You may assume 1 <= n <= 100000.

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.