A prison warden liked to play mind games with his prisoners. One day, he retrieved three of the brightest - Davis, Jones and Smith - and made a deal with them.

"I'm going to line the three of you up in a column alphabetically, facing forward, and then blindfold you. I'll then place a hat upon each of your heads - I've got two yellow ones and three blues one to choose from. Then, I'll remove the blindfolds. You're not allowed to move or communicate with one another in any way. I'll give you ten seconds, and if the first one of you to speak can correctly blurt out what color hat you're wearing, I'll pardon all three of you and set you free. But if that first guess is wrong wrong, all three of you will go before the firing squad."

After a quick huddle, the three readily agreed to the warden's deal. They spent the night celebrating, and the next day, the three happy prisoners were being processed and released. How did they succeed in outsmarting the warden?

Click here for the answer.

Answer: Remember: Davis is in front, Jones is behind him, and Smith is behind Jones. And the warden has two yellow hats and three blue hats. Here's how they figured it out.

If Smith (in the back) sees two yellow hats in front of him, he knows he's wearing a blue hat and says so immediately. If he says nothing, then it becomes apparent that Davis and/or Jones are wearing blue hats. If Smith is silent, Jones looks at Davis's hat. If it's yellow, he knows his own hat is blue and says so. (If his hat were yellow as well, Smith would have spoken up.) But if Davis's hat is blue, Jones is uncertain about the color of his own hat.

If neither Smith nor Jones speaks up, Davis immediately knows that his hat is blue and says so before the 10 seconds are up.