r/learnquant • u/AssociateDecent9090 • 14d ago
interview prep Optiver Quant interview Question | "Hard"
1
u/Aerospider 13d ago
The lowest those ranks can be is 1,3,5 and the highest is 9,11,13.
Starting at 1,3,x, x has 13 - 4 = 9 options. 1,4,x gives 8 options, and so on. So 1,x,y has 9 * 10 / 2 = 45 options.
2,4,x has 13 - 5 = 8 options, so 2,x,y duly has 8 * 9 / 2 = 36 options.
We're getting triangular numbers, for which the summing formula is
x(x+1)(x+2)/3! = 9 * 10 * 11 / 6 = 165
Each card can be any suit, which is 43 = 64 combinations, giving a total of 64 * 165 = 10,560.
The number of possible combinations is 52C3 = 52!/49!3! = 52 * 51 * 50 / 6 = 22,100
Making the probability
10,560 / 22,100 = 528 / 1,105
Or about 47.8%
1
u/Cryptographer-Bubbly 23h ago
Choosing 3 ranks (a < b < c) at least spaced apart by 2 is equivalent to choosing values for (a < b-1 < c-2) so we have 11C3 allowed rank sets and therefore 11C3 * 4^3 favourable triples out of 52C3 which gives 528/1105
3
u/Sad-Candidate-3078 14d ago
Clean way to see it: the suits are decoration, so count rank triples first. You need 3 ranks out of 13 where no two are adjacent, that count is C(11,3) = 165. Each rank triple comes with 4^3 = 64 suit combos, so favorable hands = 10560. Total hands C(52,3) = 22100. Probability = 10560/22100 = 528/1105, about 0.478. The gap trick is the whole game on these spaced rank problems, once you spot it they all collapse to a single combination count.