Color of the last ball

You have 20 blue balls and 14 red balls in a bag.
You put your hand in and remove 2 at a time.

  • If they’re of the same color, you add a blue ball to the bag.
  • If they’re of different colors, you add a red ball to the bag.

( Assume you have a big supply of blue & red balls for this purpose).

Note: When you take the two balls out, you don’t put them back in, so the number of balls in the bag keeps decreasing.

What will be the color of the last ball left in the bag?

Hints
  • Complete Solution
2905 successful submissions.
Click here to jump start your coding interview preparation