def prime_jumps(cell: list[int], rule: str = "prime") -> int:
The round: one of the two problems in Uber's HackerRank online assessment (90 minutes, camera on in several reports). Eleven reports from November 2025 to August 2026 describe it, usually paired with a tree problem. Several reports call it a DP; one compares it to LeetCode 1696 (Jump Game VI) with a different jump rule. One write-up gives the full rules, an example and the constraint n ≤ 10^4. One graded part.
Problem
cell is a row of n integers and you start on cell 0. From cell i you may:
i + 1, ori + p, where p is a prime whose last digit is 3 (3, 13, 23, 43, 53, ...).Each cell you land on adds its value to your score. You must finish exactly on the last cell, n - 1. Return the maximum score. In the reported version cell[0] = 0 and n ≤ 10^4.
def prime_jumps(cell: list[int], rule: str = "prime") -> int: ...
Example
cell = [0, -10, -20, -30, 50]
0 -> 3 -> 4 (jump 3, then step 1) score -30 + 50 = 20
0 -> 1 -> 4 (step 1, then jump 3) score -10 + 50 = 40
answer: 40
The jump rule is worded three ways. Clarify it first. Most reports say a jump is a prime ending in 3. One says any integer ending in 3, which adds lengths like 33 and 63. One says you may jump to any later index whose last digit is 3. The three rules give different answers on the same array, so rule selects one: "prime" (the default, the majority reading), "ends_in_3" or "index_ends_in_3". One test runs all three.
Notes: the function name, the rule parameter, raising ValueError on an empty array, and every example except the one above are ours. The reference counts cell[0] in the score; that only matters if cell[0] is not 0, and no test depends on it.
Reported as one of two problems in a 90-minute HackerRank assessment, with the camera on in several reports and a single monitor in one. A replier on one report, who did not say which two problems they got, passed every test on the first and 10 of 15 on the second, and was told they passed the OA. Another says the platform let you add your own test cases, and some hidden cases only show pass or fail without the expected output. The write-up with the full rules used a sieve for primes ending in 3 up to n plus this DP, and says it is fast enough for n up to 10^4.
Also reported as Prime Jumps · Jump Game Prime · Jump Game VI (LeetCode 1696) Variant
The round: one of the two problems in Uber's HackerRank online assessment (90 minutes, camera on in several reports). Eleven reports from November 2025 to August 2026 describe it, usually paired with a tree problem. Several reports call it a DP; one compares it to LeetCode 1696 (Jump Game VI) with a different jump rule. One write-up gives the full rules, an example and the constraint n ≤ 10^4. One graded part.
Problem
cell is a row of n integers and you start on cell 0. From cell i you may:
i + 1, ori + p, where p is a prime whose last digit is 3 (3, 13, 23, 43, 53, ...).Each cell you land on adds its value to your score. You must finish exactly on the last cell, n - 1. Return the maximum score. In the reported version cell[0] = 0 and n ≤ 10^4.
def prime_jumps(cell: list[int], rule: str = "prime") -> int: ...
Example
cell = [0, -10, -20, -30, 50]
0 -> 3 -> 4 (jump 3, then step 1) score -30 + 50 = 20
0 -> 1 -> 4 (step 1, then jump 3) score -10 + 50 = 40
answer: 40
The jump rule is worded three ways. Clarify it first. Most reports say a jump is a prime ending in 3. One says any integer ending in 3, which adds lengths like 33 and 63. One says you may jump to any later index whose last digit is 3. The three rules give different answers on the same array, so rule selects one: "prime" (the default, the majority reading), "ends_in_3" or "index_ends_in_3". One test runs all three.
Notes: the function name, the rule parameter, raising ValueError on an empty array, and every example except the one above are ours. The reference counts cell[0] in the score; that only matters if cell[0] is not 0, and no test depends on it.
| Approach | Notes |
|---|---|
| Top-down memoised recursion gives the same O | n * P) work, but Python's recursion limit makes the iterative DP the safer choice at n = 10^4. |
Common mistakes: Leaving out the step of 1; one report stresses that a move is a step of 1 or a prime ending in 3, and both belong in the transition.; Testing primality inside the DP instead of sieving the primes ending in 3 up to n once.; Reading the jump rule loosely: most reports say a prime jump length ending in 3, one says any length ending in 3, and one says a jump to an index ending in 3. The answers differ, so confirm which one your version uses.; Overshooting the last cell: the route must finish exactly on it.
What candidates did: One write-up sieved the primes ending in 3 up to n and used dp[i] = cell[i] + max(dp[i-1], dp[i-p]), and says that is fast enough for n up to 10^4.
What passers do: A replier on one report, who did not say which two problems they got, passed every test on the first problem and 10 of 15 on the second, and was told they passed the OA.
Edge cases to test: All negative values (you must still land on the last cell); n below 4, where no jump fits and only steps work; n near 10^4, where a per-step primality test is too slow.
Send them this page. It is free to read, no account needed.
What you just read — canonical solution, follow-up arc, what passing candidates actually did — exists for all 83 Uber questions, refreshed monthly from new candidate reports.