Everybody seems to think that a job at Google would be a dream. Bean bag chairs, creative coworkers, and free food and snacks whenever you want them, all under the roof of one of the coolest buildings in the city (depending on which city you live in). However, it’s not without its challenges.
The following riddle is featured in Google’s interview process and every candidate has to attempt it. Give it a try and see how you fair. If you answer it correctly, you might have a job at Google in your future.
100 prisoners are lined up by an executioner, who places a red or blue hat upon each of their heads.
The prisoners can see the hats of the people lined up in front of them, but they cannot look at the hats behind them, or at their own, and they can only answer with the color red or blue. They may not make any movements while in their place in line.
Starting at the back of the line, the executioner asks the last person to state the color of his hat.
In order to live, the prisoner must answer correctly. If he doesn’t, he is killed instantly and silently.
This means that the other prisoners will hear the answer, but will not know whether or not it was correct.
The night before the line-up, the prisoners can discuss a strategy to help them survive. What should they do?
Here’s a picture to help you visualize the problem: