Interview Question
Software Engineer / Developers4? if i pick 3 consisting of 1 red, 1 blue and 1 yellow i will need just one more so that i will hv two of the same color..
If u can pick the one u like, y don't u just pickup any 2 of the same color? :-)
I think, u cannot see the color while u r picking up. Assume u r blindfolded (or in dark), then how many beans u need to pick?
Um, it's still 4 even if you're picking blindfolded. After you've picked 3, the 4th one HAS to match the color of one of the 3 you've picked before!
What he seemed to be trying to say was that in the worst case, the first 3 will turn out to be of different colors. The best case is 2 when it just so happens that you pick both of the same color (blindfolded or not!).
yes, 17 is wrong. 4 is the correct answer..... You just need 4 chances to pick two balls of same colors, provided any color.....
If there is a constraint that you should have 2 of red or 2 of blue or 2 of yellow, then we have to use the probability ratios otherwise, we don't even have to care about the probabilities.
Hey guys..if u saying it as 4 then you are assuming tht ur picking 1 color each time for first 3 then 4th one will be one among the previous...i dont know pigeon hole but you are making an assumption here, aren't you. why cant we pick 2 of same colors in straight 2 picks..so answer will be 2 then,
and if you can explain who you apply pigeon hole principle it will be great...
Umm, no, this is the case when we have an equal probability of picking either of the balls, here the probability is different, 1/16, 1/32, 1/48..so the answer is not 2. It is more than 2.
Its easy to understand if you think of it this way. Out of every 6 balls you pick, 3 will be yellow, 2 blue and one red.
So ans = 1/6*2/6 +2/6*3/6 + 1/6*3/6 = 11/36
I think its 49.
We're sure that there would be at least 2 when we pick all.
Starting from here,
1). We can safely drop 16 (In the worst case, all the red beans are missed).
2). Of the remaining (after the worst-case), we can again drop 31 (all can be blue in the worst case).
Total - (31+16) = 49.
Correct me if I'm wrong.
4 is the answer, apply pigeon hole principle.
- Anonymous October 22, 2010