Amazon Interview Question
Software Engineer / DevelopersCountry: India
I agree with Sathiya (except the white balls need to be included in the second bag as well).
Normal Scenario.
Let's say we do it like this
Jar A - 50 Red Balls
Jar B - 50 Green Balls
So Probability will be 0.5*1 + 0.5*0 = 0.5
But we are not getting any number from jar B as there is no Red Ball. So to increase the chances we do like this.
Jar A - 1 Red Ball
Jar B - 49 Red Balls and 50 Green Balls
So Probability will be 0.5*1 + 0.5 * (49/99) = 74/99.
So the maximum probability will be 74/99 of picking the red ball from a random jar.
In bag1 place only one red ball and put all the remaining red and black balls on bag2.
- Sathiya January 23, 2013prob: 1*0.5+49/99*0.5