# Puzzle | Find the last ball to remain after the entire process

**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:

- Find minimum elements after considering all possible transformations
- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 2 | (Find ages of daughters)
- Puzzle 3 | (Calculate total distance travelled by bee)
- Puzzle 4 | (Pay an employee using a 7 units gold rod?)
- Puzzle 13 | (100 Prisoners with Red/Black Hats)
- Puzzle 5 | (Finding the poisoned wine)
- Puzzle 6 | (Monty Hall problem)
- Puzzle 7 | (3 Bulbs and 3 Switches)
- Puzzle 8 | (Find the Jar with contaminated pills)
- Puzzle 9 | (Find the fastest 3 horses)
- Puzzle 10 | (A Man with Medical Condition and 2 Pills)
- Puzzle 11 | (1000 Coins and 10 Bags)
- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle 14 | (Strategy for a 2 Player Coin Game)