Find the 3 fastest horses out of 25 race horses. You have only one track, which can race 5 horses at a time, and since you have no watch, you only know the order the horses finished in.
What is the fewest number of races you need to find the 3 fastest horses?
Assume each horse always runs its fastest, and no two horses are equally fast.
This Google 25 horses puzzle is a classic tech interview question that they once actually asked in their interviews.
Preparing for a brain teaser interview? Check out our ultimate guide to brain teaser interviews.
Solution
7 races
Split the horses into 5 groups of 5. Race each group, and then take the 5 winners and race those. Now you have the fastest horse.
Label the groups A to E by the rank their winners placed in the 6th race. In each group, number them by their rank within the group. E.g., group B’s fastest horse got 2nd place in the 6th race, and B2 would be the 2nd fastest horse in that group.
Now eliminate horses where we know there must be 3 faster:
- All of groups D and E, because A1, B1, and C1 are faster than their fastest
- C2-5, for the same reason
- B3-5, because they’re slower than B1-2 in their group and also A1
- A4-5, because they’re slower than A1-3 in their group
So that leaves us with exactly 5 horses to race: A2, A3, B1, B2, and C1. The fastest two in this 7th race must be the 2nd and 3rd fastest overall.
We know 7 must be the fewest, because you need 5 races to just see every horse once, and a 6th race to find the fastest. There are still multiple horses that can be the 2nd (or 3rd) fastest at that point (e.g., A2 and B1), so you must need at least one more race.
Disclosure: The post contains affiliate links, through which I may earn a small fee if you make a purchase, at no additional cost to you. As an Amazon Associate I earn from qualifying purchases.

