This “hats puzzle” was described on December 26, 2016 on NPR’s Car Talk show. Sadly Tommy died in 2014 and the show was a rebroadcast so this puzzler has probably been used before.
My book Interview Puzzles Dissected doesn’t include this puzzle but it does include some other similar hats puzzles so this one can give you some of the flavor of those puzzles. The following version is my modified version of the puzzle, but the logic is the same.
A sadistic jailer plays a little game with new inmates. When a new prisoner arrives, he gathers that person and the two inmates who have been incarcerated the longest and blindfolds them. He then places a hat on each of their heads. He has three white hats and two black hats.
Next the jailer places the prisoners in a line so each can only see the hats of those in front of him. In this case the new prisoner, Art (three years for jaywalking), is first so he can see both of the other prisoners’ hats. Next comes Billy “The Blade” (seven years for failing to signal a lane change) who can only see the third prisoner. Last comes Clever Carter (three months for self-dealing millions of dollars from a charity) who can see no one.
If a prisoner correctly guesses his hat color, he gets a year off of his sentence. If he guesses incorrectly, he adds two years to his sentence. If he doesn’t guess at all, his sentence remains unchanged.
The warden asks Art what he thinks and Art replies, “I don’t know.”
Next the warden asks Billy who also says, “I don’t know, either.”
Finally the warden asks Carter who answers, “I know my hat color!”
What color is Carter’s hat?
Try to work it out and then follow this link to see the solution.