unknown Interview Question
Data ScientistsCountry: United States
You can just do the math, there's a way to tidy it up, but to map out playing through, you get
Pay first time, you win 25% of the time and get better odds 75% of the time
Pay second time, you win 33.33% of the time and get better odds 66.66%
...
P1 = (1/4) * 100 + (3/4) * P2 - x
P2 = (1/3) * 100 + (2/3) * P3 - x
P3 = (1/2) * 100 + (1/2) * P4 - x
P4 = 100 - x
Substituting these, setting to 0 and solving for x you get 40.
To see it with the numbers:
Case of play once and pay 25, you get:
1/4 times you get 75
3/4 times you get -25
With replays and paying 40, you get:
1/4 times you get 60
1/4 times you get 20
1/4 times you get -20
1/4 times you get -60
Agree with your answer but there's a simpler way to see it.
E[cost] = (1/4) * x + (1/4) * 2x + (1/4) * 3x + (1/4) * 4x = (5/2)x
The above is simply a translation of expected value definition, assuming we keep going until we win (*not* assuming this leads to a more complex problem, would probably be a fun discussion with an interviewer). And we can immediately see we want x <= 2/5 * box value to get cost <= box value
2.5x
mean= x*probablity(first time he get 100 one)=x/4 + (2x)*probablity(first time he didn= not get but got second time) =2x*3/4*1/3=2x/4 + (3x)* probabality(not getting first two time and then getting)= 3x*3/4*2/3*1/2=3x/4 + (4x)*probabality(getting it finally)=4x*3/4*2/3*1/2*1=4x/4
s0 x/4+2x/4+3x/4+4x/4=2.5x
I mean the issue with setting x at 40 is that your probability of getting the hundred increases as you redraw. So you have a 25% chance of success at draw 1, 33% at draw 2, 50% at draw 3, 100% at draw 4.
So you are paying 40 bucks for 25% of 100, 80 bucks for 1/3 of 100, 120, for 50% of 100, and 160 for 100 guaranteed
If you think about it rationally you are paying 80 bucks for 2 draws where you are more likely to lose than win and when you get to draw 3 where you are 50/50 on a win and you've paid more than the win is worth.
The following explains my thinking: E/V Draw 1: 0.25(100-x) + 0.75(-x ), Draw 2: 0.33(100-2x) +0.66(-2x), Draw 3: 0.5(100-3x) + 0.5(-3x), Draw 4: 1(100 - 4x)
So if x is 40 you have a negative EV on every draw and cumulatively the EV is pretty negative. I mean each draw is essentially an independent event with its own probabilities you can't just say there is a uniform 25% chance at the beginning of each draw being successful, the whole point is that the probability of success changes with each draw.
4x
- v January 31, 2019