unknown Interview Question for Data Scientists


Country: United States




Comment hidden because of low score. Click to expand.
0
of 0 vote

4x

- v January 31, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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

- Anonymous January 31, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

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

- Yawn February 08, 2019 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

w/o replacement:

E[cost] = (1/4) * x + (2/3) * x + (1/2) * x = (5/3)x

- Shosha February 27, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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

- Aashu October 28, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

$48

- Isidore12 December 13, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

100-4X

- vaibhav January 08, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

2.5x

- khushnewton2014 June 02, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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.

- Anon February 28, 2022 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More