DEV Community

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

Collapse
 
bradtaniguchi profile image
Brad

I remember going over this problem in class, it was a good time and we eventually came up with the same solution as stated by @idanarye . There was caveat that was brought up that should be mentioned and that's we shouldn't have a way to track individual race horse times.

Otherwise I could solve this problem by stating "time every horse using a stop watch", thus 5 races are the minimum to "get the speed" of every horse.

The stop-watch approach is 0 fun, but it is worth pointing out a missing constraint could totally change the problem.

I love puzzles/problems like this as they wreck your brain, and yet make your really think 😄