Three blue hats
I recently was given the following problem during an interview.
3 persons are in a dark room along with three blue hats and two red hats. Each person picks a hat randomly without knowing its colour. When the light comes, the first person expresses she cannot tell what colour her hat is. Same for the second one. The third one is blind and exclaims she knows which colour her hat is.
Let’s call the characters A, B and C in order of appearance and let’s express the solution space as binary numbers where 0 is blue, 1 is red. Solutions are expressed in terms of binary numbers representing CBA sates.
space = {000,001,010,011,100,101,110}
111 is not possible as there are only two red hats.
The uncertainty of A translates in {x,y in space such that x xor y = 001}
The uncertainty of B translates in {x,y in space such that x xor y = 010}
The solution is therefore the intersection of {x,y in space such that x xor y = 001} and {x,y such that x xor y = 010} which is {x,y such that x xor y = 011} or {001,010}
Therefore the third character wears a blue hat. The same result can be achieved using if then and else. However this way of expressing the solution shows more. For one it shows that the solution is symmetric around the third person as the narration indicated. It also makes it clear that what makes the solution possible is the di-symmetry in the number of hats. Which means that, it is as logical to solve the problem from the narrative as to go through the resolution steps. A quick text analysis shows the characters symmetry and the hats di-symmetry and leads to the conclusion.
You can also memorise the solution, or the steps, but it is not as fun.
It is really unfortunate I did not have the wit to come up with all that until I reflected a bit on the story. I am sure I would have made a better impression otherwise. Oh well…
May 6th, 2008 at 3:48 am
[...] Finance « Three blue hats [...]