Fog Creek Software
Discussion Board




fogcreek puzzle

The solution seems overly complicated.

Why can't each guy just say what color the next (actually, previous in line, but next to be asked a question) guy's hat is?

Dan Davis
Friday, June 06, 2003

Because then on average only 50% would be saved.

Consider the case where every other hat is a different color.  No one would be able to correctly identify their own hat while at the same time saying the hat of the guy in front of them.

mhp
Tuesday, June 10, 2003

Interesting problem. Good way to check if the programmer is familiar with XOR operation. But why limit the number of colors to 2? Let's say the number of programmers is N and the number of colors of the hats is K. How many programmers will survive in this case? ;)

Peter
Tuesday, July 15, 2003

*  Recent Topics

*  Fog Creek Home