Monday, October 16, 2017

That's The Color Of Last Ball


What was the challenge? 

There could be 3 possible combinations that we could get on each removal.

1. One is Red & other is Blue. 

In this case, we are taking off Blue & Red but adding Red back though from other source. Effectively we are taking off only Blue keeping number of Red balls same.

2. Both are Red.

We are taking off 2 Red balls but adding 1 Blue.

3. Both are Blue.

Again we are taking off both Blue balls but adding 1 from other source. Effectively, we are keeping number of Blue intact in such cases.

What we observe from this is that the Red is always taken off in pair. And if it is taken off in single then other Red takes it's place as seen in case 1 above. On the other hand, Blue is added or taken off in single.


Since there are even number of Red balls i.e.10 which only can be taken off in pair, there won't be any single Red balls at the end. Hence, last ball must be Blue.


Logic To Find Out The Color Of Last Ball
 
Sub question's Answer :

For odd number of Red balls i.e. 11 here, if taken off in pair then the last ball would be the Red always. Hence, the last ball must be Red in the case.


Logic To FInd Out The Color Of Last Ball

No comments: