## unknown Interview Question for Data Scientists

• 0

Country: United States

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

4x

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

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

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

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

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

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

\$48

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

100-4X

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

2.5x

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.

### 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.