Color of last ball II Puzzle-Asked in interviews.
You have 20 blue balls and 13 red balls in a bag.
You put your hand in and remove 2 at a time.
If they’re of the same color, you add a blue ball to the bag.
If they’re of different colors, you add a red ball to the bag.
Assume you have a big supply of blue & red balls for this purpose.
Solution: Red Ball
There are 3 possible cases of removing the two balls…
a) If we take off 1 RED and 1 BLUE, in fact we will take off 1 BLUE
b)If we take off 2 RED, in fact we will take off 2 RED (and add 1 BLUE)
c) If we take off 2 BLUE, in fact we will take off 1 BLUE
So in the case of (a) or (c), we are only removing one blue ball, but we always take off red balls two by two.Now as the no. of red balls is odd, there will be one single red ball in the bag with other blue balls, and whenever we remove 1 red and 1 blue ball, we end up taking off only the blue ball. So the red ball will be the last ball in the bag.