Three Fastest Horses with Fewest Races
Finding three fastest horses in races is a medium quant interview question on Brain Teasers.
This brainteaser asks you to find the most efficient way to identify the three fastest objects when only a limited number can be compared at once. The setting is a multi-lane race track with more candidates than lanes, and the constraint that only relative ordering within each race is observed. It forces you to think about how to structure a sequence of races so that, at the end, you can be absolutely certain about the top three without having directly compared every relevant pair.
Solving it leans heavily on combinatorial reasoning, elimination logic, and careful case analysis. You need to exploit transitivity of speed comparisons to discard large groups of candidates after each race, while tracking precisely which ones remain plausible contenders. Interviewers watch whether you can design an information-efficient tournament structure, argue rigorously that no possible top-three candidate has been overlooked, and justify that your schedule is optimal in terms of the number of races, not just valid.
What it tests
When you must identify the top $k$ elements from a set of $n$ items, but can only compare a limited number at a time, the key is to minimize redundant comparisons by structuring the process as a series of elimination rounds. Each round should maximize information gained about relative rankings, especially among the best performers, while systematically excluding those who cannot possibly be among the top $k$. The principle relies on the fact that, after each comparison, you can eliminate not just the slowest in that race, but also any item that cannot possibly outrank the current leaders due to transitivity. This reduces the search space rapidly, and the clever design of the final comparison(s) ensures that no possible candidate for the top $k$ is missed. The efficiency comes from recognizing which elements can be safely ignored based on the outcomes and the structure of the races, not just their direct results.
Practise this question with written feedback, or hear it in a spoken mock interview.
Get started free