dreamz's logic question!


Recommended Posts

my interviewer for a consulting job asked me this riddle during the interview, and i solved it. it's fun!

an evil demon captures 3 men, and he tells them there are 5 hats, 2 white and 3 black. he puts one hat on each man without telling them the color (so no one knows), and he places them on steps. they can only look forward, so the last guy can see the two men in front of him, the second guy can only see the first guy in front of him, and the first guy can see no one.

each man must tell the demon the color of his hat. if he is correct, he may leave. if he is incorrect, he gets executed.

after 30 seconds, the first guy walks off with his life. what color is his hat?

extra bonus points: solve it in under 30 seconds. :)

i'll post the answer later, after i get some responses, hehe.

edit: answer posted, so don't read it if you want to solve it first.

Edited by dreamz
Link to comment
Share on other sites

it's actually not gameguy's problem, and it doesn't involve an algorithm of any sort. you can't sort them, and no one can move. they can only look straight ahead.

it's just a game theory question that involves common knowledge analysis.

Link to comment
Share on other sites

The guy in front has a black hat.

If the last guy saw two white hats in front of him, he'd know his was black, so he'd say "black" and walk off. Since he doesn't, that means that there's less than two white hats on the front two guys.

If the middle guy saw a white hat on the front guy's head, he'd know his was black, because there are less than two white hats on the front two guys' heads.

Since the middle guy doesn't say "black" and walk off, that means the guy in front must be wearing a black hat.

Got it in about 15 seconds ;)

Link to comment
Share on other sites

The third guy (who can see the other two) gets his right almost immediately because he sees two white hats on the other two guys; he says black. The second guy, now knowing this, says his must be black, because the previous guy couldn't be sure his was white unless both #1 and #2 have white hats (#2 sees a black hat on #1 in front of him). #1 hears all of this going on behind him and says he must have a black hat on otherwise #2 would have never made it out alive.

That's assuming #1 and #2 have white hats on. If they don't have white hats, then #3 wouldn't know what to do, and as a result, #2 wouldn't know what to do, so #1 would know his was a black hat.

Link to comment
Share on other sites

The guy in front has a black hat.

If the last guy saw two white hats in front of him, he'd know his was black, so he'd say "black" and walk off. Since he doesn't, that means that there's less than two white hats on the front two guys.

If the middle guy saw a white hat on the front guy's head, he'd know his was black, because there are less than two white hats on the front two guys' heads.

Since the middle guy doesn't say "black" and walk off, that means the guy in front must be wearing a black hat.

Got it in about 15 seconds ;)

yeah that works if the FIRST guy wasnt in front........

Link to comment
Share on other sites

The guy in front has a black hat.

If the last guy saw two white hats in front of him, he'd know his was black, so he'd say "black" and walk off. Since he doesn't, that means that there's less than two white hats on the front two guys.

If the middle guy saw a white hat on the front guy's head, he'd know his was black, because there are less than two white hats on the front two guys' heads.

Since the middle guy doesn't say "black" and walk off, that means the guy in front must be wearing a black hat.

Got it in about 15 seconds ;)

highlight to see answer.

sort of. there are only 3 people, so the middle guy can only see the guy in front. we can reason like this:

suppose the first guy thinks he's white. if the second guy is also white, then the 3rd guy would've known he was black, and he would've left already, but he doesn't.

if the second guy is white, and he sees the first guy is white, he knows that the last guy would see both hats and know he's black, and he would've left. thus, the second guy knows he cannot be white. therefore, he is black. since the second guy knows he's black, he can say 'black" and leave.

now, the first guy knows that neither guy behind him have left yet, he knows that they don't know their own colors. thus, his hat must be confusing them, hence, it is black.

Link to comment
Share on other sites

thanks gameguy. i couldn't get it working right. :laugh: and i got your answer. ;)

congrats to those who got it. if you enjoyed that, you should consider taking game theory at your university. :)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.