Optiver · Probability & Brainteasers
Compute probabilities and expectations in random processes
TrueInterview
October 7, 2026 · 10 min read
Expect a fast-paced drill on probability and expectation: a run of brief, self-contained puzzles that you work out on a whiteboard. For each one the interviewer wants a tidy formulation, the correct method, and an exact closed-form result — or a precise numeric value when no clean closed form is available — all within a couple of minutes. Every random choice is uniform and independent unless a part says otherwise.
Constraints & Assumptions
- A "fair die" means a six-sided die uniform on ; a "fair coin" means uniform on .
- A "standard 52-card deck" has 13 ranks with 4 suits apiece; cards are drawn without replacement unless a part explicitly says "with replacement".
- Report exact values (fractions or closed forms) whenever they exist; if they don't, reduce the problem to a finite linear system or DP and give the resulting number.
- No part depends on any other.
Clarifying Questions to Ask
- For "expected sum / product" problems with a stopping rule: do the rolls that trigger the stop count toward the sum or product? (Take it that they do — every roll made is counted.)
- For card draws: does the rank product treat A as 1 and J/Q/K as 11/12/13 rather than 10? (Yes, as each part specifies.)
- For the grid and graph walks: what exactly is the absorbing set, and where does the walk begin? (See the individual parts; on the grid the "boundary" is the outer ring of cells and the "center" is an interior cell sitting as far from the edge as possible.)
- For "with replacement" sampling: may a single person's draw repeat a value, and does a repeat count as drawn? (Yes.)
- If the closed form is unwieldy, is it acceptable to give a reduced linear-system or DP formulation plus a numeric answer? (Yes — show the setup, then the number.)
Part 1
Distinct digits. Pick an integer uniformly at random from 1 through 10,000 inclusive. What is the probability that every digit in its decimal representation is different (no digit repeats)?
Hint — Count by digit length: Split by how many digits the number has (1, 2, 3, 4 digits, plus the lone value 10,000). Inside each group, count the numbers with distinct digits using the rule that a leading digit cannot be zero — for instance, for 3 digits: .
What This Part Should Cover
- The right case split by digit length, with the no-leading-zero rule applied.
- Not forgetting the endpoint 10,000 and deciding whether it counts.
- Dividing the favorable count by the exact denominator 10,000.
Part 2
Stop when > 4. Keep rolling a fair die until a roll comes up greater than 4 (that is, 5 or 6). What is the expected sum of every roll you made?
Hint — One-step / conditioning: Condition on the opening roll: with probability you halt (the roll is in ); with probability you carry on from scratch after having added a value uniform on . Write .
What This Part Should Cover
- A renewal / first-step split into the "halt" and "carry on" branches.
- The conditional means and computed correctly.
- Solving the equation that refers to itself for .
Part 3
Three-card rank product. Take 3 cards uniformly without replacement from a standard 52-card deck. Assign ranks , the cards – their own values, , , . What is the expected value of the product of the three ranks?
Hint — Linearity won't do — use power sums: The product over a without-replacement triple expands through symmetric-function identities. Writing (each rank value occurs 4 times), the sum of products over ordered distinct triples equals ; divide by the ordered count .
What This Part Should Cover
- Spotting the dependence (no replacement) and reaching for the power sums .
- The correct Newton-style identity for .
- Counting ordered (or unordered) consistently in both numerator and denominator.
Part 4
Cancel H/T pairs. Flip 100 fair coins. Keep removing one Head together with one Tail until no more pairs can be removed; what remains is the count of unmatched flips. What is the expected number of coins left?
Hint — It's an absolute difference: Once pairs are cancelled the leftover is , where . Equivalently it is for a simple random walk; apply the standard mean-absolute-displacement identity .
What This Part Should Cover
- Turning "cancel pairs" into .
- Knowing or deriving for the symmetric walk.
- Arriving at the exact form together with its numeric value.
Part 5
Stop on two identical in a row (sum). Roll a fair die until two consecutive rolls come up equal for the first time. What is the expected sum of all the rolls?
Hint — Decouple count from per-roll mean: Past the first roll, every later roll repeats its predecessor with probability , so the number of rolls is . Argue that conditioning on the repeat happening does not pull the per-roll mean away from (every face is equally likely to be the one repeated), hence — or confirm it with a 6-state linear system keyed on the previous face.
What This Part Should Cover
- Deriving from the geometric stopping rule.
- Arguing that the stopping rule leaves the per-roll mean at (symmetry over faces).
- Multiplying the two together for the expected sum.
Part 6
Run of 3 in 8 flips. Flip a fair coin 8 times (order counts). What is the probability that the sequence contains at least one run of 3 consecutive identical outcomes (HHH or TTT, anywhere)?
Hint — Count the complement with a DP: Count the sequences with no run of length using a small DP over states (current symbol, current run length in ); subtract from .
What This Part Should Cover
- Working with the complement (no run of 3).
- A correct run-length DP or recurrence (Tribonacci-style transitions).
- The final probability as , reduced.
Part 7
1D walk with die-based steps. Begin at position 0. On each step roll a die: a roll of moves you right by that many units; a roll of moves you left by (so ). What is the expected number of steps until ?
Hint — First-step + symmetry: The step distribution is symmetric ( each with probability , mean 0). Let be the expected steps to absorption; for , otherwise . Because only 10 unknowns remain; solve the linear system. Hint — Wald-style sanity check: . Since is a martingale, , which gives a range you can use to check the linear-system answer.
What This Part Should Cover
- Writing the absorbing first-step recurrence with overshoot handled (terms where vanish).
- Using the symmetry to shrink the system.
- Optionally the martingale bound as a cross-check.
Part 8
Two 3-digit numbers, two-digit difference. Choose two integers independently and uniformly from 100 to 999. What is the probability that their absolute difference is a two-digit number (from 10 to 99 inclusive)?
Hint — Count pairs by gap size: With values, the number of ordered pairs separated by exactly is . Sum over and divide by .
What This Part Should Cover
- Counting ordered pairs at a fixed absolute gap .
- Summing the arithmetic series over .
- Reducing over .
Part 9
Two particles on an octagon. On a cycle with 8 vertices, put two particles at opposite vertices (4 apart). Every second each particle independently moves one step clockwise or counterclockwise (fair coin). What is the expected number of seconds until they land on the same vertex?
Hint — Track the gap, not both particles: The (signed) gap shifts by the difference of two steps: with probability , with probability , with probability . The parity of the gap never changes, so the even-distance states form the chain; meeting means gap . Set , use by symmetry, and solve.
What This Part Should Cover
- Collapsing two walkers into a single gap chain on .
- The correct transition probabilities for the gap.
- Using by symmetry and solving for .
Part 10
Per-face running sums to 100. Roll a fair die over and over. For each face keep track of . Stop the moment any . At that stopping time , what is the expected number of even rolls (2, 4, 6) that were seen?
Hint — Even-count is half the roll-count: Whether a roll is even (probability ) is independent of its value, and the stopping rule looks only at values. is a martingale, so optional stopping gives . The real work is finding . Hint — Get E[τ] by a tail sum: stops when count first reaches (so for ). Use , where — that is, all six counts stay under their thresholds.
What This Part Should Cover
- The independence/martingale argument tying even-count to .
- Converting the rule into count thresholds .
- A correct multinomial tail-sum (or absorbing DP) for plus a numeric value.
Part 11
Thirteen cards, no aces. Draw 13 cards uniformly without replacement from a standard deck. What is the probability the hand holds no aces?
Hint — Hypergeometric: Take all 13 from the 48 non-aces: .
What This Part Should Cover
- Recognizing the hypergeometric "everything from the safe pile" count.
- The correct ratio of binomials.
Part 12
2D walk to the boundary of a grid. A particle begins at the center of a grid (interior cells; the outer ring is an absorbing boundary). Each second, flip two fair coins: HH = North, TT = South, HT = West, TH = East (one step each, all four directions equally likely). What is the expected time to reach the boundary?
Hint — Discrete Poisson / Dirichlet problem: Let be the expected time; on the boundary ring, and for interior cells . Solve the linear system (the grid's two-axis symmetry cuts down the unknowns), then read off the value at the center.
What This Part Should Cover
- Noticing the four directions are equiprobable ( each) and writing the harmonic recurrence with on the boundary.
- Using reflective symmetry to reduce the system.
- A numeric expected hitting time from the center.
Part 13
. Roll 3 fair dice. Compute .
Hint — Factor over independence: , and independence turns this into with .
What This Part Should Cover
- Factoring the MGF-like quantity across independent dice.
- Computing and cubing it.
Part 14
Stop on two identical in a row (product). Roll a fair die until two consecutive results come up equal for the first time. What is the expected product of all the rolls?
Hint — Compare growth vs. stopping decay: Write the conditional-expectation system (expected product still to come, given the last face was ). Check whether it admits a finite nonnegative solution — that is, compare the spectral radius of the multiplicative operator against 1.
What This Part Should Cover
- Seeing that this is not the "expected sum" case — the product can grow geometrically while the stopping probability only decays geometrically.
- Formalizing it through the linear system / operator spectral radius (which is greater than 1).
- Concluding that the expectation diverges.
Part 15
Bankruptcy in 10 rolls. You begin with $10. Roll a fair die exactly 10 times. An even roll adds its face value to your money; an odd roll subtracts it. What is the probability you are bankrupt (money ) at any point during the 10 rolls?
Hint — Absorbing first-passage DP: The increments are , each with probability . Let be the probability of ever reaching within rolls remaining starting from wealth ; then for , for , and . The answer is .
What This Part Should Cover
- Listing the six signed increments correctly.
- A first-passage DP over (rolls remaining, wealth) — ruin at any step, not merely at the end.
- The numeric ruin probability .
Part 16
No overlap in two length-3 samples from . You and a friend each independently draw 3 numbers from with replacement. What is the probability that none of your numbers shows up among your friend's three draws?
Hint — Condition on how many distinct values you drew: Let be the number of distinct values among your 3 draws (). Compute , then note the friend dodges all values with probability ; sum over .
What This Part Should Cover
- Obtaining the distribution of the distinct-value count (surjection / Stirling-style counts).
- The conditional avoidance probability .
- Combining them by total probability.
Part 17
Last roll is 2 when the sum first exceeds 100.