← Jane Street Interview Insights

Jane Street·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Jane Street data scientist interview with a pretty gnarly probability/game theory problem. One question, no fluff, just math and reasoning under pressure.

Questions Asked (1)

Q1

You roll a fair six-sided die repeatedly, accumulating a running sum. You can stop anytime and collect the current sum, but if the sum ever hits a perfect square (1, 4, 9, 16, ...) you lose everything and get zero. There's no roll limit. What's the optimal stopping strategy, and what's the expected payoff under that strategy starting from zero?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This one wrecked me for the first few minutes.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the problem as a Markov decision process where the state is the current sum, and the value function satisfies a Bellman equation. Recognize that the process is a random walk with absorbing square states, and solve for the optimal stopping boundary by comparing the immediate reward of stopping versus the expected value of continuing. Then compute the expected payoff from zero using the derived optimal strategy.

Pro tip: Emphasize that the optimal strategy is a threshold policy: stop when the current sum is sufficiently far from the next square, and the threshold depends on the distance to the next square. Also, note that the expected payoff is finite and can be computed via dynamic programming or by solving a system of linear equations.

1. Define the state and value function

Let V(s) be the maximum expected payoff starting from sum s. If s is a perfect square, V(s)=0. Otherwise, V(s)=max(s, (1/6)∑_{i=1}^6 V(s+i)).

2. Identify the optimal stopping region

Show that V(s) ≥ s, and the optimal strategy is to stop when s ≥ V_continue(s). Argue that the stopping region is characterized by a threshold: stop if s is large enough relative to the next square.

3. Solve for the value function

Use dynamic programming or solve the Bellman equation numerically. Because the state space is infinite but the process resets at squares, consider the value function modulo the distance to the next square.

4. Compute the expected payoff from zero

Starting from 0, the first roll cannot hit a square (since 1 is a square, but 0 is not a square? Actually 0 is a square? Typically squares are 1,4,9,... so 0 is not considered). So V(0) = (1/6)∑_{i=1}^6 V(i). Use the computed V(s) to find V(0).

5. Verify and interpret

Check that the strategy is indeed optimal by confirming the Bellman equation holds. Discuss the intuition: the expected payoff is finite and the optimal strategy balances risk and reward.

Key Points to Mention

  • Markov decision process formulation with state as current sum.
  • Bellman equation: V(s) = max(s, average of V(s+i) for i=1..6).
  • Optimal stopping threshold policy: stop when current sum is high enough relative to the next square.
  • Dynamic programming or linear equations to solve for V(s).
  • Expected payoff from zero is finite and can be computed numerically.
  • Intuition: the risk of hitting a square increases as sum grows, so stop before the risk becomes too high.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.