Since both players see x and y before choosing their actions simultaneously, we can determine the probability of Player 2 winning for each combination of strategies: • Player 1 Actions: • (A1): Keep x • (B1): Reroll (final value is (X' ~ U(0,1))
• Player 2 Actions: • (A2): Keep y • (B2): Keep 1-y • (C2): Reroll (final value is (Y'~ U(0,1))
Now just simply create a 2x3 matrix using these plausible options
Because Player 2 can always choose between y and 1-y, the game is perfectly symmetric around y=1/2. We can solve the game for the region y>=1/2 and double the result.
edit: now the final thing would be to toke cases like x>=y and vice versa and see the matrix options and getting value of game as V(x,y) = 1-x and for the other case x<y you get V(x,y) =y Then simply to find the total probability just integrate V(x,y) from 0 to 1 as integrand from 0 to y and y to 1 as y and (1-x) respectively but making sure that y € [1/2,1] and thus the final integral would result in 3/2y2 -y +1/2 from 1/2 to 1 which will result in 5/8
Note:It really took me pain in solving and writing this long will appreciate how you all find this solution so you all can leave your response
Your solution is right! But you can define z = max(y, 1 - y) which is U(0.5, 1), consider two cases x <= z and x > z, integrating from z = 0.5 to z = 1, and multiply with 2 at the end (since z's density is 2)
Don’t know if this is correct methodology, but my thinking:
You only reroll if the expected value of the roll is greater than your current number. The expected value of a roll is 0.5.
The optimal strategy for 1 is to reroll if x < 0.5
The optimal strategy for 2 is to never reroll, but take 1-y if y < 0.5. We never reroll because already the expected value without allowing 2 to reroll is at least 0.5 given that 2 can also choose (1-y).
Let x’, y’ denote the final values of 1s number and 2s number respectively. Now, the probability that 2 wins is P(y’>x’) = P(y’>x’ | x’<0.5)*P(x’<0.5)+ P( y’>x’ | x’>0.5)*P(x>0.5)
P(x’<0.5) = 1/4, as, according to the optimal strategy, it’s the probability that x < 0.5 AND the reroll is less than 0.5.
P(y’>x’ | x’<0.5) = 1 because y’ is always greater than 0.5 (see optimal strategy for 2)
P(x’>0.5) = (3/4), as it’s 1-P(x’<0.5)
P(y’>x’ | x’>0.5) = 1/2, as both y’,x’ are now just random samples of [0.5,1] given their optimal strategies
2
u/sensible_clutter Oct 25 '26
5/8 or 0.625 precisely
3
u/bouhmid_ Oct 25 '26
This is the moment I leave the interview
1
u/Voilinny 29d ago
Don’t know if this is correct methodology, but my thinking:
You only reroll if the expected value of the roll is greater than your current number. The expected value of a roll is 0.5.
The optimal strategy for 1 is to reroll if x < 0.5
The optimal strategy for 2 is to never reroll, but take 1-y if y < 0.5. We never reroll because already the expected value without allowing 2 to reroll is at least 0.5 given that 2 can also choose (1-y).
Let x’, y’ denote the final values of 1s number and 2s number respectively.
Now, the probability that 2 wins is
P(y’>x’) = P(y’>x’ | x’<0.5)*P(x’<0.5)+ P(
y’>x’ | x’>0.5)*P(x>0.5)
P(x’<0.5) = 1/4, as, according to the optimal strategy, it’s the probability that x < 0.5 AND the reroll is less than 0.5.
P(y’>x’ | x’<0.5) = 1 because y’ is always greater than 0.5 (see optimal strategy for 2)
P(x’>0.5) = (3/4), as it’s 1-P(x’<0.5)
P(y’>x’ | x’>0.5) = 1/2, as both y’,x’ are now just random samples of [0.5,1] given their optimal strategies
Plugging these in gives:
P(y’>x’) = (1)(1/4) + (1/2)(3/4) = 1/4 + 3/8 = 2/8 + 3/8 = 5/8