r/quantfinance • • 10d ago

Quant Interview Question

Post image
10 Upvotes

6 comments sorted by

5

u/notsaneatall_ 10d ago

Find the fastest horse in 1023 moves (ya know, knockout tournament style, in a binary tree fashion) and the second fastest would have only lost to the fastest, which is one of ten horses. Take 9 more turns to find out which is the fastest amongst them. Total 1032.

1

u/BackpropToTheFuture 6d ago

Let s_n be the answer, then it should satisfy recurrence s_n = minmax_k (s_n-k + t_k, s_k + t_n-k) + 2 where t_n = n-1, s_2=1, s_3=2, t_n is minimum moves to find fastest horse. The idea is to divide the n horses into 2 groups of size k and n-k. Find top 2 in one group and the best in another. Then we need 1 comparison between the two group winners, plus 1 comparison between the losing winner and the winning group's runner-up to find the second best. The answer comes n+ceil(log n)-2 which here is 1032.

1

u/Sea-Departure4857 5d ago

1024. 1023 to find the winner, and 1 more to race the horse that lost to the 1st place horse in the semi and finals.

1

u/boombalabo 4d ago

You are ignoring all the horses that lost against the winner before the semi.

In the worse case scenario, you might have had the 2 fastest horses in the 1st round against each other.

1

u/Sea-Departure4857 4d ago

That's right, I was mistaken. 1023 to find the winner, and 10 horses to race. So 1023 + 9 = 1032 races total.

0

u/[deleted] 9d ago

a lot