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


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