Got this for an interview and didn't get it. How to solve?
You and your opponent have a uniform random sampler from 0 to 1. We both sample from our own machines. Whoever has the higher number wins. The catch is when you see your number, you can resample. The opponent can re sample once but you can resample twice. What’s the probability I win?
My not-confident-at-all approach: For each player you come up with a strategy that revolves around the idea of “if this number is too low, resample.” you know that for myself, I have three samples, and the EV of the third sample is 1/2. So for the second sample, if it’s below 1/2, you should resample; if above 1/2, do not resample. And you do this for the first sample with a slightly higher threshold. And then assuming our player is opponent they will follow the same approach, but they only have two rolls.
No matter what, we know the game can end with six outcomes: it can end with me ending on the first, second, or third sample, and them ending on the first or second outcome. We just condition on each of those six cases and find the probability that my roll is bigger than their roll on that conditional uniform distribution.
Refer to AnCar's answer.
Each player is attempting to maximize their own score. Suppose you have $n$ rolls. The most you can expect from these $n$ rolls is to end up with a score of greater that $1 - 1/2^n$ with a probability of $1/2$ (assuming they can simply choose the max of their rolls). The difficulty is that, at each point, you are stuck with whatever your last roll was, and the knowledge of how many rolls you have left. So, suppose you are on your $k$th roll of the game and you got a roll of $\alpha \in [0,1]$. You can expect, with $1/2$ probability, that you will get a score greater than $1 - 1/2^{n - (k - 1)}$ with your remaining $n - k$ rolls. So, you should only roll again if $\alpha < 1 - 1/2^{n - (k - 1)}$. Assuming this strategy is optimal, we can calculate the expected value (average score) from playing this strategy. There is a $1/2^n$ chance you get a score greater than $1 - 1/2^n$ on your first roll. Theere is a $1/2^{n - 1}$ chance you get a score greater than $1 - 1/2^{n - 1}$ on your second roll. So on, and so forth. $$ E(\text{score}) = \frac{1 - 1/2^n}{2^n} + \frac{1 - 1/2^{n - 1}}{2^{n - 1}} + \cdots + \frac{1 - 1/2^2}{2^2} + \frac{1 - 1/2^1}{2^1} $$ Let's put these all under a common denominator: \begin{align*} E(\text{score}) &= \frac{2^0(1 - 1/2^n) + 2^1(1 - 1/2^{n - 1}) + \cdots + 2^{n - 2}(1 - 1/2^2) + 2^{n - 1}(1 - 1/2^1)}{2^n} \\ &= \frac{(2^0 + 2^1 + \cdots + 2^{n - 2} + 2^{n - 1}) - (\overbrace{1/2^n + 1/2^n + \cdots + 1/2^n}^{n \text{ times}})}{2^n} \\ &= \frac{(2^n - 1) - n/2^n}{2^n} \\ &= 1 - \frac{1 + n/2^n}{2^n} \\ &= 1 - \frac{1}{2^n} - \frac{n}{2^{2n}}. \end{align*} Keep in mind that this is all speculation. I am not sure if the strategy I have selected is optimal. Please point out a better strategy if you find one. In the context of this problem. That would make the expected score of the first player (the one with three rolls) equal to approximately $0.828$ and the expected score of the second player (the one with two rolls) equal to $0.625$. These values are somewhat expected: $0.828$ is slightly less than $1 - 2^3 = 0.875$ and $0.625$ is slightly less than $1 - 2^2 = 0.75$.
This still doesn't answer the question of the probability that the first player wins. We have only shown that the first player will win more often. I might think about the problem more, but this is what I have to say for now.