## Yahoo Interview Question for Developer Program Engineers

• 0

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%

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

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

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

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

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

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%

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

@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!

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

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

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

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

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

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

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

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

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

We are allowed to move the balls before blindfold.

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

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.

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 :)

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

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?

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

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

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

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

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

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.

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

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

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.

Comment hidden because of low score. Click to expand.
-2
of 2 vote

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.