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.

Google
Statistics & Math
Data Scientist
Google
November 29, 2026
Data Scientist
Technical Screen
Statistics & Math
Medium

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
Markov chains
pattern waiting times
overlap
first-step analysis
martingales
How to Approach This
  1. Define your hypotheses (H0 and H1) clearly before performing any test.
  2. Calculate required sample size BEFORE running an experiment, using power analysis.
  3. Remember the Central Limit Theorem: sample means become approximately normal with large n.
  4. Watch for Simpson's paradox. Always segment data by key dimensions.
  5. 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 Questions
Sample Answer
Clarify

Fair coin, independent flips. THHT_{HH} and THTT_{HT} 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...


Submit Your Answer
Markdown supported