100 PROGRAMMERS IN A ROW

 

One hundred programmers are lined up one in front of the other by an evil human resources person such that programmers can see only the programmers in front of them. The HR person puts a red hat or a blue hat on every programmer. The programmers cannot see their own hats, nor can they see the hats of those behind them, but they can see the hats of the people in front of them. The HR person starts with the last programmer in the back and says,
“What color is your hat?”
Programmers can answer with only one of two words, red or blue. If the answer does not match the color of the hat on the person’s head, the candidate is dismissed. Then the evil HR person moves on to the next programmer, going from the rear to the front of the row. Programmers in front get to hear the answers of the programmers behind them, but not whether they are dismissed or not. They can consult and agree on a strategy before being lined up, but after being lined up and having the hats put on, they can’t communicate in any way other than by what has been specified.
What strategy should the programmers select to guarantee the maximum number of surviving programmers?


100 PROGRAMMERS IN A ROW

 




Show Answer

Post your Comments below...

Comment Form is loading comments...