Expected Flips to See HH Versus HT in a Coin Stream
Last updated: November 29, 2026
Quick Overview
Flip a fair coin repeatedly. Find the expected number of flips until HH first appears and until HT first appears, and explain why they differ even though both patterns have probability 1/4.
0
0
0 solved
Flip a fair coin repeatedly. Find the expected number of flips until HH first appears and until HT first appears, and explain why they differ even though both patterns have probability 1/4.
Google interviewers like this pair because it breaks a common intuition: patterns with equal frequency can have different waiting times. They check for correct state machines and a clear explanation using overlap.
What the Interviewer Expects
- Build states for each pattern's prefix
- Solve first-step equations: E[HH] = 6, E[HT] = 4
- Explain the role of self-overlap
- Optionally use the overlap (correlation) formula
- Sanity check by simulation
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 wait for HTH and for HHT?
- Generalize to a coin with P(H) = p.
- Can you derive the answers using a fair betting martingale argument?
- Why does the long-run frequency of HH and HT stay equal despite different waits?
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. and are the first times the last two flips match the pattern. We want both expectations and an explanation for the gap....
Approach
Track the longest prefix of the pattern matched by the recent flips. Write one equation per state for expected remaining flips. Then explain using how the pattern overlaps with itself: after a near mi...