Skip to content

Instantly share code, notes, and snippets.

@emanuelfeld
Created October 28, 2017 08:47
Show Gist options
  • Save emanuelfeld/2b4d040c149ab9bc43126484c1df5b66 to your computer and use it in GitHub Desktop.
Save emanuelfeld/2b4d040c149ab9bc43126484c1df5b66 to your computer and use it in GitHub Desktop.

Start out with 25 horses. Group them arbitrarily into races with 5 horses. Label them.

Race 1

a
b
c
d
e

Race 2

f
g
h
i
j

Race 3

k
l
m
n
o

Race 4

p
q
r
s
t

Race 5

u
v
w
x
y

In each race, there will be 3 fastest. Necessarily, the slowest 2 in any race won't be among the 3 fastest horses of the 25. Let's arbitrarily decide (WLOG) that the horses finish in alphabetical order. That means:

Race 1

1. a
2. b
3. c

Race 2

1. f
2. g
3. h

Race 3

1. k
2. l
3. m

Race 4

1. p
2. q
3. r

Race 5

1. u
2. v
3. w

Now, make a race where the competitors are the first place winners of the previous 5 races.

Race 6

a
f
k
p
u

Again arbitrarily, let's say the finish in alphabetical order. So:

Race 6

1. a
2. f
3. k
  • At this point, we've disqualified p and u.
  • We've also disqualified q and r, which are slower than p, and v and w, which are slower than u.
  • We can also disqualify l and m, which are slower than k, the 3rd place finisher in Race 6.
  • Same with h, which is slower than a, f, and g.

Now we'll have a final race. Take the 2nd and 3rd place finishers from Race 6. Pit them against the 2nd and 3rd place finishers from Race 1 and the 2nd place finisher from race 2. That means:

Race 7

f
k
b
g
c

There will be a top 2 in this race. Say it's:

Race 7

1. b
2. g

The top 2 from this race will be the 2nd and 3rd fastest horses.

To be assured you've found the fastest 3 horses, you need to conduct 7 races.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment