There are 20 red balls and 16 blue balls in a bag. Any 2 balls are removed at each step and are replaced with a new ball on the basis of the following conditions:
- If they are of the same color, then they are replaced by a red ball.
- If they are of different colors, then they are replaced with a blue ball.
Find the last ball to remain after the entire process.
Here replacement means that the new ball is inserted into the bag.
Answer: Red ball
Blue balls can only be reduced by two and that too if the 1st condition is satisfied, i.e., if you choose both blue balls, then they are replaced by a single red ball. In no other ways you can reduce blue balls. Red balls can be reduced by one on the basis of 2nd condition if you choose both different balls and on the basis of 1st condition if you choose both red balls.
Now, as there are even number of blue balls and blue balls can only be reduced by two, so at any stage of replacement you will be left with either 0 or 2 or 4….(even number) of blue balls in the bag. There will never be such a condition when blue balls are in odd number of quantity in the bag. Therefore in any combination of replacements the last ball remaining in the bag will be a red ball.
This article is contributed by Ayush Jauhari. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.