25 Horses, 5 Lanes - Find Top 3 Fastest

Problem 25 horses must be raced on a track with only 5 lanes. There is no stopwatch, so each race reveals only the relative finishing order of the horses in that heat. Find the minimum number of races required to identify the top 3 fastest horses overall.

Input / Output

  • Input: 25 horses with fixed, distinct, unknown speeds
  • Output: the minimum number of races needed to determine the top 3, plus the racing strategy that achieves it

Constraints

  • At most 5 horses per race
  • Only ranking within a heat is available, never a time — so results cannot be compared across heats except through horses they share
  • Each horse's speed is consistent from race to race

Example

  • Splitting the 25 horses into 5 groups of 5 gives 5 initial heats, one per group
  • After the race of the 5 group winners, every horse that placed 4th or 5th in its own heat is already eliminated, as is every horse in the groups of the 4th- and 5th-placed winners
asked …
LeaderboardSalaryAccount