25 Horses, 5 Tracks: Puzzle and Step-by-Step Solution
Logic & Strategy
Medium
Reported at Optiver, Citadel, SIG, Akuna
The puzzle
You have 25 horses and a track that races five at a time. There is no stopwatch: each race only tells you the finishing order of the five horses in it. Horses run at consistent speeds. What is the minimum number of races needed to find the three fastest horses?
Short answer: Seven: five heats, a race of the five heat winners, and one final race among the five horses that could still be second or third.
Step 1: Races 1 to 5: the heats
Split the horses into five groups, A to E, and race each group. Every horse must run at least once, so these five races are unavoidable. Label the finishers A1 (fastest in A) to A5, and so on.
After the heats, any horse finishing fourth or fifth in its heat is out: at least three horses are faster than it. That leaves 15 horses, but you still do not know how the groups compare.
Step 2: Race 6: the winners
Race A1, B1, C1, D1 and E1. Relabel the groups by this result, so A1 wins, B1 is second, C1 third. A1 is the fastest of all 25 horses, because it beat every other heat winner, and each heat winner beat its group.
D1 and E1 are slower than A1, B1 and C1, so they cannot be top three, and neither can anyone in groups D or E. In group C, C1 has A1 and B1 ahead of it, so C2 and C3 are out. In group B, B1 has A1 ahead, so B3 is out. In group A, A2 and A3 remain possible.
Step 3: Race 7: the five contenders
The candidates for second and third place are A2, A3, B1, B2 and C1. That is exactly five horses, so one race settles it: the top two finishers in race 7 are the second and third fastest overall.
Total: 5 + 1 + 1 = 7 races.
Step 4: Why six races are not enough
Every horse must race at least once, which takes five races. After those, you do not know the fastest horse until the five winners have raced each other, so a sixth race is needed just to identify the champion. After six races, the five contenders above are still unresolved in general, and no single race among them was run yet. So six cannot guarantee the top three, and seven is the minimum.
A common follow-up asks for the top five. The same elimination logic works, but it takes more races, and interviewers are listening for the method of tracking which horses are still possible.
Why interviewers ask it
Draw the 5 by 5 grid after race 6 and cross out horses that have three known faster horses. That picture is what interviewers want to see.
Knowing the proof is half of it. Work 25 Horses, 5 Tracks interactively, then take it under a clock with the rest of the Outcry simulators.