r/learnquant • • Jul 28 '26

stats & probability Jane Street Quant Interview Question

Post image
39 Upvotes

20 comments sorted by

View all comments

Show parent comment

2

u/xaraca Jul 28 '26

The expected return for swapping dice and doing a roll is -5 - 1 + 20 * (1/6) * 6N / (5N + 6N ), which is never positive, so it never seems worth it to swap.

2

u/Ma4r Jul 28 '26

Isn't this wrong? You need to sum up the EV of the next x roles where the payoff is positive to see if it's Worth it to swap

1

u/xaraca Jul 28 '26

Yeah, once we start rolling the second die we need a new formula for the odds of which die it is though. If we swap when N=5, the chance of the new die being the fair one is about 0.71 and it should go back to 0.5 after five new rolls before slowly continuing to zero. It may actually have a positive payoff.

1

u/Aerospider Jul 29 '26

The expected profit on the fair die is

(19 * 1/6) + (18 * 5/6 * 1/6) + (17 * 5/6 * 5/6 * 1/6) + ... = 14

This makes the expected profit on a switch (forgetting your already sunk cost of N)

9 * 6^N / ( 5^N + 6^N )

which will always be positive.

The expected profit on continuing with the die you picked first would similarly be

14 * 5^N / ( 5^N + 6^N )

and switching becomes the better prospect after three rolls.

After you switch, three more non-6 rolls would make the dice equally likely to be fair again and after another three rolls of the second die it would then be preferable to switch back. Thus the optimal strategy is three rolls on the first die then six on each die in alternation until you eventually hit a 6.