Puzzle | Black and White Balls
You have 20 white and 13 black balls in a bag. You pull out 2 balls one after another. If the balls are of same color, then you replace them with a white ball – but if they are of different color, you replace them with a black ball. Once you take out the balls, you do not put them back in the bag – so the balls keep reducing. What would be the color of the last ball remaining in the bag.
This puzzle looks like a difficult one, till you find out the solution. But, the minute you get the solution, you feel that this was dead simple. If you pull out 2 black balls, you replace them with a white ball. On the other hand, if you pull out one black and one white – you replace it with a black ball. So, the black balls would always be odd in numbers – either you remove 2 together or remove 1 and add 1 – so they remain odd always. Hence, the last ball to stay in the bag would be a black ball.
This article is contributed by Ajay Puri. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.