The 25 Horses Puzzle: Find the Top 3 in 7 Races

You have 25 horses and you want to find the three fastest. You have a racetrack with 5 lanes, so you can race 5 horses at a time and see their finishing order. There is no stopwatch — you only learn the relative order of the horses in each race, not their times. Horses run consistently (a horse’s speed never changes from race to race).

What is the minimum number of races you need to guarantee you’ve found the top 3, in order?

This one shows up constantly at Google, and it’s a favorite at quant firms like Jane Street and Citadel. It’s a great puzzle because the “obvious” answer is wrong in a way that’s easy to talk yourself into, and the real answer requires you to notice which horses you can eliminate without racing them again. The no-stopwatch rule is the whole trick — if you had a timer, you’d just run 5 races, record times, and sort. Take a minute before revealing the strategy.

Related reading

💡Strategies for Solving This Problem

Start by ranking within groups

Split the 25 horses into 5 groups of 5 and race each group once. That's 5 races, and now you know the internal ranking of every group — but nothing across groups yet.

Race the winners

The fastest horse overall must be the winner of its own group, so the 5 group-winners are the only candidates for 1st. Race those 5 against each other. After this race you know the single fastest horse for certain — and, more importantly, you can throw out a lot of horses.

The real insight: eliminate, don't re-race

A horse can only be in the top 3 if at most 2 horses are known to be faster than it. Use that rule ruthlessly on the results of the winners' race:

  • If a group's winner finished 4th or 5th among the winners, nobody in that group can be top 3 — drop all 10 of those horses.
  • In the remaining groups, count how many horses are already proven faster than each horse. Anything with 3+ faster is out.

You'll find only a handful of horses survive. One final race settles 2nd and 3rd. Now count your races.

Scroll to Top