Hedge Funds puzzles, solved step by step
- Puzzles
- 100
- Traced to a firm
- 38
- Topics
- 14
- Hard
- 30
061How many flips of a fair coin do you expect to need before you see two heads in a row? Why is the answer different if you wait for a head followed by a tail?Squarepoint CapitalLondon · 2025
Try it first
What are the expected waits for HH and for HT?
Show the worked solution
Six flips on average for two heads in a row, and four for a head then a tail. Track how far along the pattern you are. For HH, a tail at any point sends you back to the start, including right after a head. For HT, a head after a head keeps you one step away, so progress is never lost. Solving the two small chains gives 6 and 4.
Why do two equally likely patterns take different times?
Think of two ladders where a slip costs you differently. On one, slipping from the first rung drops you to the ground; on the other, you can only ever slip back to the first rung. Both patterns are equally likely in any given pair of flips, but after one head the wrong next flip costs you everything for HH and nothing for HT. A head then a tail breaks HH and restarts it; a head then a head is still a perfect start for HT.
In the HH chain a tail from the one-head state falls back to the start, so the expected wait is 6 flips; in the HT chain a head from the one-head state stays where it is, so progress is never lost and the wait is 4 flips. How do you solve the chain?
Let E0 be the expected flips still needed from the start and E1 after one head. For HH, E0 = 1 + E1/2 + E0/2 and E1 = 1 + E0/2, because a tail from one head sends you back, and these solve to E1 = 4 and E0 = 6. For HT, the one-head state just waits for a tail, which takes 2 flips on average, and reaching the first head takes 2 more, giving 4. Say the states out loud before the algebra; the interviewer wants to hear them named.
The relationshipE0 expected flips still needed from the start E1 expected flips still needed after one head 1 the flip you are about to make What it says in wordsEach state's expected wait is one flip plus the average wait from wherever that flip sends you.What is the general pattern?
Patterns that can fail back to nothing take longer. The expected wait for n heads in a row is 2 to the power n + 1, minus 2: 2, 6 and 14 flips for one, two and three heads. This is a Markov chainA process whose next step depends only on the current state, not on how it got there, so it can be solved state by state. at heart, and the same state-by-state method handles anything that depends on a path: a streak, a barrier, a drawdown rule on a trading book.
Where candidates lose it
The usual wrong answer is 4 for both, reached by noting that each pattern has a one-in-four chance in a pair of flips. That treats the flips as separate pairs, which they are not: a pattern can start at any flip, and what happens after a failure depends on the pattern.
The second loss is setting up one equation instead of two. Name the states, start and one head, and write one equation for each.
What the interviewer asks next
- How many flips do you expect to need for three heads in a row?
- Two players race: one wins at the first HH, the other at the first HT. Who is more likely to win?
- With a coin that lands heads 60% of the time, how long do you expect to wait for HH?
Asked at Squarepoint Capital, Quantitative Research, London, 2025 (Wall Street Oasis):
statistical problems e.g. # of throws expected to get 2 heads in a row
071You start with Rs 10 and bet Rs 1 at a time on a game you win with probability 0.55, winning or losing Rs 1 each round. What is the chance you reach Rs 20 before you go broke?Two SigmaNew York · 2023
Try it first
Roughly what is the chance of reaching Rs 20 first?
Show the worked solution
About 88%. Let r be the ratio of losing to winning odds, 0.45/0.55 = 9/11. The chance of reaching Rs 20 from Rs 10 is (1 - r to the 10th)/(1 - r to the 20th), which simplifies to 1/(1 + r to the 10th). Since r to the 10th is about 0.134, the answer is 1/1.134, about 88.1%. A fair game would give exactly 50%.
Why does a small edge per bet become a large edge on the game?
Think of a tug of war between two teams, one a shade stronger. A single pull is close to a coin toss, but the rope has to travel a long way before either side wins, and every pull leans the same way. Reaching Rs 20 or Rs 0 takes many Rs 1 bets, and the 0.55 edge applies to every one of them, so the chance of winning the whole game rises far above 0.55. Staking all Rs 10 on one bet would give only 55%; betting Rs 1 at a time gives about 88%.
How do you get the formula?
Let P(i) be the chance of reaching 20 from a stake of i. One bet later you are at i + 1 with chance p or i - 1 with chance q, so P(i) = p P(i + 1) + q P(i - 1), with P(0) = 0 and P(20) = 1, and the solution is P(i) = (1 - r to the i)/(1 - r to the 20), where r = q/p. For a fair game the formula collapses to a straight line, P(i) = i/20, because a fair game keeps your expected wealth at 10, so 20 times P must equal 10. Checking the fair case is the fastest way to trust the biased one.
The relationshipP(10) the chance of reaching Rs 20 before Rs 0 from Rs 10 r the ratio of the losing chance to the winning chance r^20 the same ratio over the full distance of Rs 20 What it says in wordsThe chance of success from the middle is one over one plus the odds ratio raised to the distance to either end.Betting Rs 1 a time from Rs 10, a fair game reaches Rs 20 first 50% of the time, a 0.55 edge lifts that to 88.1% and a 0.45 disadvantage cuts it to 11.9%, because the small edge on each bet compounds over the many bets the game takes. How do you compute r to the tenth in your head, and what is the lesson?
Square repeatedly: 9/11 squared is 81/121, about 0.669; squared again about 0.448; again about 0.201; times 0.669 gives about 0.134. The desk lesson is about sizing: with an edge, make many small bets so the edge compounds; without one, the same arithmetic works against you, and at 0.45 the Rs 1 strategy reaches Rs 20 only 12% of the time against 45% for one bold bet. This is the classic gambler's ruinThe problem of a gambler betting fixed amounts until reaching a target or losing everything, solved as a random walk with two absorbing ends. result, and it is why a trader with a real but thin edge wants volume, not size.
Where candidates lose it
The common wrong answer is 55%, the chance of winning one bet, carried over to the whole game. It ignores that the game takes many bets and the edge applies to each of them.
The second loss is setting up the recursion and getting lost in the algebra. Write the answer in the form 1/(1 + r to the 10th), check it on the fair case, and compute the power by repeated squaring.
What the interviewer asks next
- With a win probability of 0.45, should you bet Rs 1 at a time or everything at once, and why?
- How many rounds do you expect the game to last at p = 0.5?
- The casino has unlimited money and you never stop at Rs 20. What is your chance of eventual ruin at p = 0.55?
Asked at Two Sigma, Research, New York, 2023 (Wall Street Oasis):
Biased gamblers ruin problems; Markov Chain problems; sampling uniformly from triangle
