Algorithm · Point72 · Medium
You are playing a game with a fair six-sided die (faces 1 through 6). You are allowed at most n rolls. After each roll you observe the outcome. You then have a choice: Stop and take the current roll as your final payoff. Continue, discard that roll, and roll again. You must stop after the n-th roll (you cannot roll more than n times). You play optimally to maximize the expected payoff. Given n, compute that maximum expected value. Output a floating-point number with an…
Checking your access…