Expected Coin Flips Until HTH Versus HHT

Last updated: November 29, 2026

Quick Overview

Flip a fair coin repeatedly. What is the expected number of flips until the pattern HTH first appears, and until HHT first appears? If both patterns race in the same sequence, which appears first more often?

DRW
Statistics & Math
Quantitative Researcher
DRW
November 29, 2026
Quantitative Researcher
Technical Screen
Statistics & Math
Medium

0

0

0 solved


Flip a fair coin repeatedly. What is the expected number of flips until the pattern HTH first appears, and until HHT first appears? If both patterns race in the same sequence, which appears first more often?

Pattern waiting time questions are a favorite at DRW because they reward setting up a small Markov chain and they have a counterintuitive twist. The interviewer checks state design, solving linear equations quickly, and explaining why overlap changes waiting times.

What the Interviewer Expects
  • Defines states as longest suffix matching a prefix of the pattern
  • Writes and solves the expectation equations
  • Gets 10 for HTH and 8 for HHT
  • Solves the race and gets 2/3 for HHT
  • Explains self overlap as the reason
Key Topics to Cover
Markov chains
expected waiting time
pattern matching
Penney's game
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
  • Expected flips until HH? Until HT?
  • Give the general formula using pattern autocorrelation.
  • With a biased coin p of heads, recompute HHT.
  • Which pattern of length 3 beats HHT in a race?
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. Waiting time counts flips up to and including the completing flip....

Approach

States track progress toward the pattern: the longest suffix of what we have seen that is also a prefix of the pattern. Let EsE_s be the expected remaining flips from state ss....


Submit Your Answer
Markdown supported

Related Questions