DEV Community

Discussion on: Can you solve the fastest horse 🐴 algorithm problem?

Collapse
 
budprager profile image
BudPrager • Edited

Given there is no constraints on what information we can gather from each race, and no constraints on assumptions. The only constraint is the number of tracks we have to use.

We can do this in five races providing we can time the races and each horse runs it's fastest every time it runs.

Split the horses into 5 groups and ensure that every horse runs at least once.

Time the horses and the 3 fastest times give you the 3 fastest horses.

Collapse
 
kokaneka profile image
kapeel kokane

I'm sorry, should have mentioned timing the horses was not an option 🙈

Collapse
 
budprager profile image
BudPrager • Edited

Yeah I was working outside of the spirit of the question, but these are the kinds of assumptions you should ask about in an interview when not specified, it shows an ability to think outside the box.