Count paths with prime-ending jumps
Company: Uber
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Take-home Project
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.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: (3,)
Expected Output: 2
Explanation: Either 1+1+1 or 3.
Input: (5,)
Expected Output: 4
Explanation: Prime-ending jump 3 plus ones.
Input: (13,)
Expected Output: 89
Explanation: Includes jump 13.
Input: (1,)
Expected Output: 1
Explanation: Only one step.
Hints
- Choose a representation that makes the requested operation direct.
- Handle empty inputs and boundary cases first.