Compute Optimal Die Re-roll Strategy
Capital OneData Scientist · OnsiteLast updated
This question tests the ability to calculate expected values and determine optimal decision thresholds in a multi-stage probabilistic game.
Problem Statement
You are playing a game with a fair six-sided die. You roll the die once and observe the outcome (1 through 6). After the first roll, you have the option to either keep the current value as your score or roll the die exactly one more time to replace your score with the new outcome. If you choose to re-roll, the second outcome is your final score regardless of whether it is higher or lower than the first.
Calculate the optimal strategy (i.e., at which values of the first roll should you choose to re-roll?) and determine the total expected value of the game if you play optimally.
Requirements
- Define the decision rule: For which values of the first roll is the expected value of re-rolling greater than the current value?
- Calculate the expected value of the final score under this optimal strategy.
Example
- If your first roll is a 1, the expected value of re-rolling is 3.5. Since 3.5 > 1, you should re-roll.
- If your first roll is a 5, the expected value of re-rolling is 3.5. Since 3.5 < 5, you should keep the 5.
Hints
Hint 1
Calculate the expected value of a single roll of a fair six-sided die.
Hint 2
Compare the first roll's value (x) to the expected value of the die (3.5) to decide if a second roll increases your expected score.
Hint 3
Sum the probabilities of each outcome under the optimal strategy to find the final expected value.
Follow-up questions
- How does the optimal strategy change if you have the option to re-roll up to two times instead of just once?
- What is the optimal threshold if the die has n sides instead of 6?
- If re-rolling cost you $0.50 and every point on the die was worth $1.00, how would that change your decision threshold?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.