Unfair Coin's Consecutive Heads

Expected flips for consecutive heads is a medium quant interview question on Expected Value.

Difficulty Medium Topic Expected Value

This question considers a biased coin and asks for the expected number of flips needed to see a given run of consecutive heads. First, the candidate analyzes the waiting time until two heads appear in a row; then the same reasoning is extended to three in a row. The twist is that the coin is not fair, so the answer must be expressed in terms of the head probability and cannot rely on symmetry. Variants of this setup appear in probabilistic reasoning rounds for quant researcher and quant trading interviews, especially where understanding of pattern occurrences in noisy signals is relevant.

Solving it leans on modeling the situation via states that encode how long the current streak of heads is, and then writing equations for the expected remaining time from each state. The interviewer looks for clear state definitions, correct conditioning on the next flip, and consistent use of linearity of expectation. They also watch how the candidate handles the "restart" behavior after tails, and whether they can generalize the two-heads argument cleanly to the three-heads case without getting lost in algebra.

What it tests

Problems involving the expected waiting time for a specific sequence in repeated independent trials are governed by the structure of Markov processes and the principle of conditioning on the present state. The key is that the process can be described by a set of states that encode the relevant memory (such as how many consecutive heads have just occurred), and the expected time from each state can be recursively related to the expected times from other states. This recursive structure arises because the process 'restarts' in a probabilistically identical way after each step, depending only on the current state and not the full history. The equations are solvable because each state transition is determined by the fixed probabilities of the underlying random process, and the absorbing state (the target sequence) provides a natural boundary condition. This approach generalizes to any sequence or pattern in a Markovian setting, not just coin flips or heads.

Practise this question with written feedback, or hear it in a spoken mock interview.

Get started free