Expected Coin Flips Until Two Consecutive Heads
Last updated: November 29, 2026
Quick Overview
You flip a fair coin until you see two heads in a row. What is the expected number of flips, and why is the answer different from the expected wait for heads followed by tails?
Capital One
November 29, 20260
0
0 solved
You flip a fair coin until you see two heads in a row. What is the expected number of flips, and why is the answer different from the expected wait for heads followed by tails?
A pattern-waiting puzzle in the style of Capital One's Data Science phone screens. The interviewer checks state-based expectation equations and whether you can explain intuitively why overlapping patterns take longer, which connects to detecting sequences in event streams.
What the Interviewer Expects
- Define states by progress toward the pattern
- Write and solve expectation equations
- Get 6 flips for HH and 4 for HT
- Explain the difference through overlap and restart behavior
- Generalize to n heads in a row
Key Topics to Cover
How to Approach This
- Define your hypotheses (H0 and H1) clearly before performing any test.
- Calculate required sample size BEFORE running an experiment, using power analysis.
- Remember the Central Limit Theorem: sample means become approximately normal with large n.
- Watch for Simpson's paradox. Always segment data by key dimensions.
- Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
- What is the expected number of flips for three heads in a row?
- If the coin lands heads with probability p, what is the expected wait for HH?
- In a race between HH and TH, which pattern appears first more often?
- How would you verify your answer by simulation?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Browse Statistics QuestionsSample Answer
Clarify
Fair coin, independent flips, stop the first time two consecutive heads appear, counting all flips. Compare with stopping at the first occurrence of HT....
Approach
Define states by how much of the pattern is currently matched. For HH: state 0 (no progress, start or just saw T) and state 1 (last flip was H). Let , be expected remaining flips from each ...