Solution
The first step is to think of different cases while removing the balls. There will be three separate cases to remove the balls from the bag.
Case1: Both balls are Red. It is mentioned in the question that if balls are of the same Color, then we add a blue ball to the bag. So, we are removing 2 Red balls and adding 1 Blue ball.
2R +1B
‘‘R’’ represents Red color ball, and ‘‘B’’ represents a blue ball.
Case2: Both balls are Blue. Since the balls are of the same Color, we add a blue ball back to the bag. So, we are removing two blue balls and adding one blue ball in this case. Overall we can say that we are subtracting one blue ball.
2B +1B = 1B
Case3: One ball is red, and another ball is blue. If colors are different, then we add a red color ball to the bag. So, overall, we are removing one blue ball here.
1R 1B +1R = 1B
Now, two scenarios can arise while removing the balls.

Scenario1: All Red balls are removed, and some blue balls are left.
If there are only blue balls left, then we get two blue balls every time we remove the balls. This falls in case2.
2B +1B = 1B
So, what is happening here is that the number of blue balls is reduced one by one. Only one blue ball will undoubtedly be left in the bag.

Scenario2: All blue balls are removed, and some red balls are left.
If there are only red balls, then we will get two red balls every time we remove the balls. This falls in case1
2R +1B
Overall, we have added a blue ball and removed two red balls. Now, again scenario1 and scenario2 can arise. Again this process will repeat. At the end of scenario2, there will be two red balls left, and when we remove the two red balls, we add a blue ball. So finally, the blue ball is left at the end.
We can see that we are always left with a blue ball, and indeed, one of the two scenarios will always arise.
Let’s suppose you think that there can be a case where only one red ball and one blue ball are left in the bag. Then it falls under case3, and after removing these two balls, we will have to add a red ball. So here, a red ball is left in the end. This is the only possibility where a Red ball is left out in the end.
1R 1B +1R = 1B
So 1R is left in the bag.
But, this case will never arise. The number of red balls is reduced only when case1 occurs. And in case1, the number of red balls is reduced in pairs, i.e., even number of red balls is always reduced. Now, the given number of red balls is even, and we know that subtracting even from even always results in even. So we can conclude that the number of red balls in the bag will be even at any point in time. So, no such case will arise where only one red ball is left in the bag.
So the answer is Blue.
What if there were 20 Blue balls and 13 Red balls?
Try to solve this on your own. You can check out the Color of the Last Ball II article for its solution.
Check out this problem  8 Queens Problem
Frequently Asked Questions
Why are puzzles important?
Puzzles enhance your ability to think. It also improves your problemsolving skills. You will have to apply your mind to solve a puzzle, so it’s also a good exercise for the mind. You will improve your logical thinking and reasoning ability by solving puzzles.
Are puzzles asked in the interview of IT companies?
Many tech giants like Google, Microsoft, etc., ask the puzzles in the interview process as they want to check your logical thinking.
Do I need to memorize all the puzzles?
No, when you try solving a puzzle yourself, it gets stuck in your memory for a long time as you have struggled to solve it. Even if you couldn’t solve it yourself, you won’t forget it for a long time as you realize the mistakes you made while solving it.
What if there were 20 Blue balls and 13 Red balls?
In this case, a single red ball will be left out.
How is the number of balls reduced in the bag if we are always adding a ball?
The number of balls is reducing since we are removing two balls and adding a single ball. So after every operation, the total number of balls is reduced by one.
Conclusion
We have extensively discussed the Arrange Cubes puzzle.
We hope that this blog has helped you understand this puzzle, and if you would like to solve more puzzles, check out these articles.
Check out some of the amazing Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Basics of C, Basics of Java, Computer Networks, etc. along with some Contests and Interview Experiences only on Coding Ninjas Studio.
Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.
Do upvote our blog to help other ninjas grow.
Happy Learning!!!