← Jane Street Interview Insights
This one took me a while to set up properly.
Model Bob's optimal strategy by determining a threshold t such that he rerolls if his first roll is ≤ t, then compute the probability Alice wins by conditioning on Bob's final roll. Use dynamic programming or direct probability calculations to find the optimal t and the resulting win probability.
Pro tip: Clearly state that Bob's decision is based solely on his first roll and not on Alice's, and that ties go to Bob, which effectively gives Bob a +0.5 advantage in comparisons.
Let Bob reroll if his first roll is ≤ t, where t is an integer between 0 and 20. If he rerolls, his final roll is uniform on 1..20; otherwise, it's his first roll.
For a given t, compute the probability mass function of Bob's final roll: P(final = k) = P(first = k and k > t) + P(reroll) * P(second = k).
Given Bob's final roll distribution, Alice wins if her roll > Bob's final roll (since ties go to Bob). So P(Alice wins) = sum_{k=1}^{20} P(Bob final = k) * P(Alice > k).
Find the t that minimizes Alice's win probability (or maximizes Bob's win probability). This can be done by evaluating the expression for each t from 0 to 20.
Plug the optimal t into the expression to get the exact probability that Alice wins.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.