There is a jar in which there are two types of candies – 20 blueberry and 16 strawberry. You perform the following steps:
1) You take out two candies.
2) If the two candies are of same flavor, you add a blueberry one otherwise, you add the strawberry one.

You repeat these two steps till there is just one candy remaining in the jar. Which flavored candy will be left?

Also, if you began with 100 blueberry candies and 93 strawberry candies, which flavor would have been the last one to remain?

Let us suppose that there are x blueberry candies and y strawberry candies. While removing the candies, there can be three possibilities:
1) 2 blueberry candies. In this case, you will replace one blueberry candy and so the jar will have x+1 blueberry and y-2 strawberry candies.
2) 2 strawberry candies. In this case, you will replace 1 blueberry candy and so the jar will have x-1 blueberry candies and y strawberry candies.
3) 1 blueberry and 1 strawberry. In this case, you will replace a strawberry candy and so the jar will have x-1 blueberry candies and y strawberry candies.

In this way at each step, we are either removing a blueberry candy or replacing 2 strawberry candies by 1 blueberry candy irreversibly till there is only one candy left. Thus each strawberry candy is equivalent to 2 blueberry candies.

Therefore, if there are odd number of strawberry candies, the last candy will be strawberry and if there are even number of strawberry candies, the last one will be a blueberry one.

Discussion