So many people would love to work at Google, but very few make it!…
We recommend you to try to find the solutions without the… you google it, or see it at the end of the text. So, go ahead, try and see if you could work at Google!…
Î“Î¡Î™Î¦ÎŸÎ£ GOOGLE #1: The black and white hats
There are 100 prisoners who have created a queue to enter the prison. Each prisoner wears a hat that is either black, or white. Each prisoner does NOT know what color hat he’s wearing, but the color of the hat of those who are ahead of him in the series (the first prisoner in line can not physically see the hat of any other prisoner and the last prisoner can see all of the others except, of course, his own). Starting from the back, one of the guards asks each prisoner to tell him what color hat he’s wearing. If the prisoner answers correctly, then let him free and not going to jail. But if you answer wrong, then puts him in the cell. If you allow the prisoners to organize a plan, how will they be released at least 99 of them?
Î“Î¡Î™Î¦ÎŸÎ£ GOOGLE #2: The 100 prisoners and 1 light bulb
There are 100 prisoners, and everyone is locked in a separate cell in isolation. There is a central â€œliving roomâ€ with a light bulb. This bulb is initially off. No one prisoner can see the light bulb from his cell. Everyday, the warden chooses randomly a prisoner, who enters the living room. While it is there, the prisoner can touch the bulb, if it so wishes. The warden gives the prisoner the choice to answer if all 100 prisoners have been to the salon until now. If the prisoner choose to respond and make a mistake, then the sergeant will perform and 100 prisoners. However, if you give the correct answer, then all the prisoners will be released. This means that the prisoner must choose to answer only if you are 100% sure about the answer you will give. The warden gives the prisoners the opportunity to gather all together one night in the courtyard, to organize a plan. What plan would that be, so that, finally, someone to choose to respond and give the correct answer?
SOLUTION FOR THE FIRST PUZZLE GOOGLE
The last prisoner will shout â€œblackâ€, if there is an odd number of black hats in front of him and â€œwhiteâ€ if it is an even number of black hats in front of him. The next prisoner will then measure the range of the number of black hats in front of him, and if it’s before, it was odd, but now it is even number, or vice versa, then you will automatically knows what color is his hat. The next prisoner (the 3rd from the back of the line) will know the color of his hat based on what he said the previous and counting how many black hats are still in front of him. In this way, the front 99 prisoners will be aware of the color of the hat and will be released. The prisoner in the back, he namely called upon to answer first, has a 50% chance to be released.
SOLUTION FOR THE SECOND PUZZLE GOOGLE
In the beginning, the prisoners select a leader. Every time a person (with the exception of the leader) walks into the living room, turns on the light (but do this only once). If you get into the living room and sees that the light is already lit, then it doesn’t do anything. When you get into the living room, the leader, turns off the light. When the chief has arrived to turn the light off 99 times, it will be 100% sure that each of the 100 prisoners has entered the room.