This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
There were 3 white hats and 2 black hats. The Jailor make three prisoners to sit one behind the other in such a way the first prisoner can't see any of the prisoners hat , the second one can see only the hat worn by the first and the third can see the hat worn by other two prisoner. Now the Jailor blindfolds all the prisoners and make them were a hat and threw away the other two hats out of sight, and promise to free the prisoner who can figure out the color of hat he was wearing. After few minute the first prisoner answers the question correct and was freed. What was the color of the hat he was wearing ?.
I think there's more to the question than you gave. Doesn't the jailer take the blindfolds off after he puts the hats on the prisoners and don't the second and third prisoners both say "I don't know what color hat I'm wearing."? Then the first prisoner can deduce what color of hat he's wearing.
Originally posted by Greg Neef: if the prisoner who can see two hats, sees two black ones his must be white.
You're on the right track here. You need to go down the line and carry it to it's logical conclusion. You have to make the assumption that all three prisoners are smart and have thought out the situation fully and logically before they answer.
(P-prisoner, W-white, B-black) I'm assuming P3 answers 1st, P2 next, P1 last. If P3 answers W - he must see 2xB P2 answers B P1 answers B If P3 answer is unsure - he sees 1xW and 1xB, or 2xW If P2 answers W - he must see 1 x B P1 answers B If P2 answer is unsure - he must see W P1 answers W (If the clue is no-one but P1 answers, therefore P3 and P2 are unsure, then P1's answer would be W)
Joined: Jun 23, 2003
Originally posted by Junilu Lacar: Doesn't the jailer take the blindfolds off after he puts the hats on the prisoners
You are right I did miss that.
Originally posted by Junilu Lacar:
and don't the second and third prisoners both say "I don't know what color hat I'm wearing."? Then the first prisoner can deduce what color of hat he's wearing
I thought that would give more clue to solve the problem and also I added "After few minutes" that is actually that make it bit obvious that they don't know the answer.
Joined: Jun 23, 2003
Originally posted by Ashok Krishnan: White. How he got it right? Pure luck!
Vinod : "I thought that would give more clue to solve the problem and also I added "After few minutes" that is actually that make it bit obvious that they don't know the answer" WoW, whats the logic behind the way you think that. What you thought obvious was very required and what you forget made the puzzle a more of a guess work. [ August 22, 2003: Message edited by: Anupam Sinha ]
Actaully, most of the versions that I've heard have the prisoners/job applicants/whatever not answering for several minutes. The fact that no one is sure about anything gives you enough information to be sure. The other two don't actaully need to say anything; the fact that they have not said anything is enough.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Only for those who don't know this riddle ...