What it takes to work for Google

Applicants for Google are tested with the '100 Hat Riddle' and the 'Switch Riddle' before they're offered a job. Now see if you can solve them:

The 100 Hat Riddle 

  • 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. 
  • Starting at the back of the line, the executioner asks the last prisoner to state the colour 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? 


The Switch Riddle 

  • One hundred prisoners have been newly ushered into prison. 
  • The warden tells them that starting tomorrow, each of them will be placed in an isolated cell, unable to communicate amongst each other. 
  • Each day, the warden will choose one of the prisoners uniformly at random with replacement, and place him in a central interrogation room containing only a light bulb with a toggle switch. 
  • The prisoner will be able to observe the current state of the light bulb. If he wishes, he can toggle the light bulb. He also has the option of announcing that he believes all prisoners have visited the interrogation room at some point in time. 
  • If this announcement is true, then all prisoners are set free, but if it is false, all prisoners are executed. 
The warden leaves and the prisoners huddle together to discuss their fate. Can they agree on a protocol that will guarantee their freedom? 

Google's Al has recently cracked both puzzles. So, tell me, are you smarter or dumber than robots? 
-via 9gag.com