**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 | Weight of Heavy Ball
- Puzzle 63 | Paper ball and three friends
- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle | Find the cat
- Puzzle | Find Number of matches
- Puzzle 2 | (Find ages of daughters)
- Puzzle 40 | (Find missing Row in Excel)
- Puzzle 9 | (Find the fastest 3 horses)
- Puzzle 8 | (Find the Jar with contaminated pills)
- Puzzle | Find The Probability of Distance in a Square
- Puzzle 51| Cheryl’s Birthday Puzzle and Solution
- Puzzle 85 | Chain Link Puzzle
- Puzzle 81 | 100 people in a circle with gun puzzle
- Puzzle | 3 Priests and 3 devils Puzzle
- Puzzle 34 | (Prisoner and Policeman Puzzle)
- Puzzle 15 | (Camel and Banana Puzzle)
- Puzzle | Elevator Puzzle
- Puzzle 31 | (Minimum cut Puzzle)
- Puzzle 28 | (Newspaper Puzzle)
- Puzzle 27 | (Hourglasses Puzzle)