Expected flips to see the pattern HTH
Asked at Jane Street, Two Sigma
You flip a fair coin repeatedly.
What is the expected number of flips until you first see the pattern HTH? Follow-up: why is HTH slower than HTT?
Show a hint
States by progress toward HTH: nothing, "H", "HT". Be careful where each flip sends you, especially a failure in the last state.