**Problem Statement:**

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

**Observations:**

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.

**References:** http://www.waytocrack.com/forum/154/find-the-last-ball-to-remain-after-the-entire-process

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 contribute@geeksforgeeks.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.

## Recommended Posts:

- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle 63 | Paper ball and three friends
- Puzzle | Weight of Heavy Ball
- Find last two remaining elements after removing median of any 3 consecutive elements repeatedly
- Puzzle 30 | (Last Palindrome Date Before 10/02/2001)
- Puzzle 15 | (Camel and Banana Puzzle)
- Puzzle 24 | (10 Coins Puzzle)
- Puzzle 27 | (Hourglasses Puzzle)
- Puzzle 28 | (Newspaper Puzzle)
- Puzzle 29 | (Car Wheel Puzzle)
- Puzzle 31 | (Minimum cut Puzzle)
- Puzzle 33 | ( Rs 500 Note Puzzle )
- Puzzle 34 | (Prisoner and Policeman Puzzle)
- Puzzle 36 | (Matchstick Puzzle)
- Puzzle 38 | (Tic Tac Toe Puzzle)
- Puzzle 39 | (100 coins puzzle)
- Puzzle 51| Cheryl’s Birthday Puzzle and Solution
- Puzzle 81 | 100 people in a circle with gun puzzle
- Puzzle 85 | Chain Link Puzzle
- Puzzle | Elevator Puzzle