25 horses, 5 tracks, find the top 3
Asked at Jane Street, Optiver, SIG
You have 25 horses and want to find the three fastest. You have a race track that can run only 5 horses at a time, and you have no stopwatch, a race tells you only the relative finishing order of those 5 horses. Assume each horse runs at a fixed speed with no ties.
What is the minimum number of races needed to identify the top 3 horses (in order), and how?