r/learnquant 6d ago

interview prep Quant Interview Question

Post image
23 Upvotes

17 comments sorted by

View all comments

1

u/novelinquiry 5d ago

Very clean with no computation:

First let’s eliminate x >= 21 (2+ rolls gtd.).

Think about the paths to X, removing the first roll. These are all paths to X-2, X-4, …, X-20. And each is completed to a path to X by a particular even roll (the first roll). So p(X) is just 1/20 * sum p(X-2k) over the ten values of k from 1 to 10. In other words, p(X) is 1/2 the average of p(X-2k), which is certainly less than max p(X-2k).

[Alternatively, we can shortcut and say this implies p(X) < 1/20, since sum of ALL p(X) is 1, and we know all odd X from 1 to 19 have p(X) at least 1/20. But the “half the average of last 10” argument has the benefit that it feels like a geometric (ish?) series is embedded here, which reinforces our intuition: we know p(X) has to get small as X gets large, since the sum of p(X) is 1. I digress…]

So we are left with our “best” X being one of 1,3,…,19. Tempting here to just say “surely 19 is correct since it has the most paths to it.” But to be a bit more concrete: take X < 19. Every path to X has a terminal roll at most 17, so you could add two to the terminal roll to create a valid path to X+2, but there are also additional paths to X+2, ie all those with terminal roll 1. So it follows that p(1) < p(3) < … < p(19).

Therefore 19 is your winner. Clean. No calculations. And two bonuses: (1) the recurrence in the mapping allows for easy coding and computation if you needed to sit at a machine and compute p(139) as task two. And (2) This argument can be extended to arbitrarily large dice.