Four criminals are caught in a minor offence, they pleaded judge to release them without any punishment. As it was a minor offence, judge told them that they will be freed without punishment, but only if they can solve a puzzle
All four of them are lined up on some steps(as shown in the picture above). A wall separates the 4th person from other three.
So to summarize:-
Criminal 1 can see 2 and 3
Criminal 2 can see 3
Criminal 3 and 4 can’t see any one else
Criminals are wearing hats, they are told that there are two white hats and two black hats. They can’t see their own hat color and are told to shout their hat color as soon as they get to know for certain what color it is.
They are not allowed to turn around or move.
They are not allowed to talk to each other.
They are not allowed to take their hat off.
Who will shout first ?
As Criminal 1 is not able to decide the color of his hat, color of Criminal 2 and 3 should not be same. Seeing the color of Criminal 3′ hat, Criminal 2 can be sure that his hat color is white.