Monday, August 1, 2011

Solution: Puzzle : Prisoners and Four - hats.


Question: http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-four-hats.html

There are two cases:
In first case, one of the three prisoners (in A, B, C) wears the single off-colour hat, thus the other two can easily deduce the colour of theirs. For example if A is single color then B can see that C and A have different color hats. From this he concludes that his color is not single so he shouts his color.

In second case, the three prisoners wear hats of the same colour, while D wears the off-colour hat. After a while, all four prisoners should be able to deduce that, since none of the others was able to state the colour of his own hat, D must wear the off-colour hat.

No comments:

Post a Comment