Three prisoners see each other's hats, but not their own. The first one in line, who doesn't see any hats, is the one who finally answers.

The three prisoners and the red hats

Strategist
Pure logic

Riddle statement

Three perfectly logical prisoners are lined up. Each one can see the hats of those in front of them, but not their own or those of those behind them.

The guard tells them that each hat is red or blue, and that at least one of them is red.

He asks them, starting with the last one in line, if they can deduce the color of their own hat. The last one answers no. The second also answers no. Then the first one deduces the color of his hat.

What color is his hat and how do he know it?