Yahoo Interview Question for Developer Program Engineers


Country: India




Comment hidden because of low score. Click to expand.
4
of 8 vote

Are we allowed to move balls between the jars?

Edit: Fresh Solution
Let P(1) is probability of choosing jar 1,
P(2) is probability of choosing jar 2,
X is the probability of choosing a red ball in jar1.
Y is the probability of choosing a red ball in jar2.

Total probability= P(1)*X + P(2)*Y
Where P(1)=P(2)=1/2

What is the maximum number of balls a jar can have??

If its 100, move 49 red balls from jar1 to jar2.
Now, jar 1 contains 1 red ball & jar 2 contains 50 blue balls & 49 red balls.
Total probability of drawing a red ball is 1/2 + 0.5*49/99= 74/99=74.74%

- Aashish July 24, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

No, an orangutan will do it for you.
you only've to spell it out for him :D

- Anonymous July 24, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yes...you can exchange the balls before you are blindfolded..but after you are blindfolded the might shuffle the jars

- irraju July 24, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

but after you are blindfold you don't know which jar will have 1 red ball... if you pick other jar then your probability of picking red ball is less than 50 i.e.. 49/99 < 50%

- Anonymous July 24, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@irraju: in that case I'll just leave one red ball in one of the bins, and use touch to know which bin has only one ball. I'll pick that one. 100% success rate!

- eugene.yarovoi July 24, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

how will you know which jar is containing red and blue balls.

- siva July 24, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

It's the one that has only one ball in it.

- eugene.yarovoi July 24, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

i thnk soln will be same we move only one ball..

- Anonymous July 26, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

with the blindfold ,how can you assure that you are moving 49 red balls form jar1 to jar2.

- @shondik August 01, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

We are allowed to move the balls before blindfold.

- Aashish August 01, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

This is the correct answer. I had read this one elsewhere before with the same answer. The wording in the problem has to be changed. You are allowed to move balls between jars before being blindfolded.

- dc360 September 08, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

Nope, dc360. They want to know your approach. Its a test of how simply you can understand a given problem with only that much info.
The approach is - pick up 1 ball from each jars. If you do this, the chances that you have a red ball is 100%. 100% is greater than 50%.
It can't get simpler than this. Every problem should not be just solved with textual mathematical knowledge :)

- invincible.om September 09, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Very well if you could change the composition of jars - I would throw all blue balls and add some red balls in this jar from first one ... now its a sure/certain event (100% Probability) ... howzatt?

- Anonymous October 15, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

To be honest, once I had a blindfold on my mind would rapidly move away from maths kind of balls!

- Horny January 28, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

please clearly mention the answer

- Anonymous July 24, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Pick one ball from both the jars.

Probability = 1/2(Probability of red+ Probability of blue)
= 1/2(1+0)
=0.5

- ColdPlay August 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Take one ball from each Jar. If you do this approach, you will definitely get a Red ball.
Definitely getting something means Probability is one (1). 1 > 1/2. Simple

- invincible.om August 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Nope, dc360. They want to know your approach. Its a test of how simply you can understand a given problem with only that much info.
The approach is - pick up 1 ball from each jars. If you do this, the chances that you have a red ball is 100%. 100% is greater than 50%.
It can't get simpler than this. Every problem should not be just solved with textual mathematical knowledge.

- invincible.om September 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 3 vote

No way you can pick Red with more than 50% probability... because if you can pick red with >50% probability then blue also can do the same thing.

if you know which is red jar and blue jar then you can move few red balls to blue jar so that you can get >50% for red

- Anonymous July 24, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

place 1Red ball in one jar and 49R+50B balls in second jar... and get one common balance and place these jars on both sides of balance... now blindfold, pick one that is on upper side of the common balance with lesser weight...

like this, need an indication to identify which jar we need to pick to get >50% probability

- Anonymous July 24, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

one solution that came into my mind was to add 1 red ball each in both baskets. so probability of picking red becomes more. but this will only happen if u are having 2 red balls with u from the beginning.

- Anonymous July 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

remove your blindfold

- nio July 24, 2012 | 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