Question: http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-three-hats.html
Answer:
For the sake of explanation let's label the prisoners in line order A B and C. Thus B can see A (and his hat colour) and C can see A and B.
The prisoners know that there are only two hats of each colour. So if C observes that A and B have hats of the same colour, C would deduce that his own hat is the opposite colour. However, If A and B have hats of different colours, then C can say nothing. The key is that prisoner B, after allowing an appropriate interval, and knowing what C would do, can deduce that if C says nothing the hats on A and B must be different. Being able to see A's hat he can deduce his own hat colour. (The fourth prisoner is irrelevant to the puzzle: his only purpose is to wear the fourth hat).
Answer:
For the sake of explanation let's label the prisoners in line order A B and C. Thus B can see A (and his hat colour) and C can see A and B.
The prisoners know that there are only two hats of each colour. So if C observes that A and B have hats of the same colour, C would deduce that his own hat is the opposite colour. However, If A and B have hats of different colours, then C can say nothing. The key is that prisoner B, after allowing an appropriate interval, and knowing what C would do, can deduce that if C says nothing the hats on A and B must be different. Being able to see A's hat he can deduce his own hat colour. (The fourth prisoner is irrelevant to the puzzle: his only purpose is to wear the fourth hat).
No comments:
Post a Comment