425
2 puzzles from Google interview, over which even geniuses have to work hard
According to rumors, competitors who come to Google to hire, asked to solve two puzzles about the prisoners.
< Website offers to smash his head to see the logic and thinking outside the box.
blue and red hats hundred prisoners build the column and all wear caps: red or blue. The number of blue and red caps unknown. Each prisoner sees only a hat in front of a standing person. Since the end of the column, the warden asks each color of his cap, and if the rights of prisoners, it is released, and if not - executed. In addition, each following a prisoner hears the reply, but does not know, he was right or not.
What we need to agree before the test concluded that appeared on the loose as many people as possible?
Otgadka
99 people, and if you're lucky, all 100 can be saved as follows. The first prisoner, risking his life, standing in front of the color names. Thus, the second person there is information about how the cap on his head. But he must help the next! Therefore prisoners before the test must agree on how they encrypt the information about the color, if the person in front, he is different. For example, if the color of my red cap, and at the next column, too red, then I say: "Red." If the color caps in the next blue, one can say, "Red" or "Red Hat". Hearing an additional word, the one who is to come, will know what color he would have to call ...
100 people and 1 light 100 from the previous tasks again went to jail.
All of them are in isolated chambers, without the ability to communicate with each other. Every day the overseer chooses a random prisoner and for a while it put in solitary confinement. It has only a light bulb and switch. Each prisoner, who was in the dungeon, can turn on or off a light bulb.
As soon as one of the prisoners says that 100 of them were in solitary confinement at least once, release them; but if he is wrong, all executed. Before this test is given to the prisoners one night to negotiate and determine the strategy.
What you need to think of the prisoners to be released, provided that other cameras can not see the light of the cooler?
Otgadka
Prisoners must select one person as an accountant, and adhere to the following rules:
< Website offers to smash his head to see the logic and thinking outside the box.
blue and red hats hundred prisoners build the column and all wear caps: red or blue. The number of blue and red caps unknown. Each prisoner sees only a hat in front of a standing person. Since the end of the column, the warden asks each color of his cap, and if the rights of prisoners, it is released, and if not - executed. In addition, each following a prisoner hears the reply, but does not know, he was right or not.
What we need to agree before the test concluded that appeared on the loose as many people as possible?
Otgadka
99 people, and if you're lucky, all 100 can be saved as follows. The first prisoner, risking his life, standing in front of the color names. Thus, the second person there is information about how the cap on his head. But he must help the next! Therefore prisoners before the test must agree on how they encrypt the information about the color, if the person in front, he is different. For example, if the color of my red cap, and at the next column, too red, then I say: "Red." If the color caps in the next blue, one can say, "Red" or "Red Hat". Hearing an additional word, the one who is to come, will know what color he would have to call ...
100 people and 1 light 100 from the previous tasks again went to jail.
All of them are in isolated chambers, without the ability to communicate with each other. Every day the overseer chooses a random prisoner and for a while it put in solitary confinement. It has only a light bulb and switch. Each prisoner, who was in the dungeon, can turn on or off a light bulb.
As soon as one of the prisoners says that 100 of them were in solitary confinement at least once, release them; but if he is wrong, all executed. Before this test is given to the prisoners one night to negotiate and determine the strategy.
What you need to think of the prisoners to be released, provided that other cameras can not see the light of the cooler?
Otgadka
Prisoners must select one person as an accountant, and adhere to the following rules:
- those who come in solitary confinement for the first time, have to turn on the light when it is turned off, or not to touch the switch when the light is on; < /
- those who come in solitary confinement for the second time, do not touch the switch;
- if the bookkeeper enters the camera and sees that the light is on, it turns off and it makes one;
- if the bookkeeper enters the chamber, and the light is off - he did not touch ..
Photos on the preview: ssboys
via www.google.com/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&ved=0ahUKEwiat4Kh9bjLAhWjQJoKHQ10CnMQjB0IBg&url=http%3A%2F%2Fssboys.com%2Fcontact&psig=AFQjCNF3D1XopzH2YBuFS9exb6oxjnp5sQ&ust=1457795411574195