# 10 little dwarves [duplicate]

A dwarf-killing giant lines up 10 dwarfs from shortest to tallest.

Each dwarf can see all the shortest dwarfs in front of him, but cannot see the dwarfs behind himself.

The giant randomly puts a white or black hat on each dwarf. No dwarf can see their own hat. The giant tells all the dwarfs that he will ask each dwarf, starting with the tallest, for the color of his hat.

If the dwarf answers incorrectly, the giant will kill the dwarf.

Each dwarf can hear the previous answers, but cannot hear when a dwarf is killed.

The dwarves are given an opportunity to collude before the hats are distributed.

What strategy should be used to kill the fewest dwarfs, and what is the minimum number of dwarfs that can be saved with this strategy?

My approach: 1st guy counts which color is max, says it, all others copy his ans. This way, we save at least 5, but I think we can optimize this, just can't figure out how....

I'm pretty sure you can save 9 dwarfs.

Dwarf 10 can see 9 hats. He counts the number of white hats and if they are even, says white. If they are odd, he says black. He cannot be saved except by pure luck.

Dwarf 9 counts the number of white hats. If it is odd, he says white (which would make it even). If it is even, he says black (keeps it even). He lives.

Dwarf 8 counts the number of white hats and adds 1 if dwarf 9 said white. He does the same thing (if odd, say white; if even, say black). He lives.

Dwarf 7 counts and adds 0, 1 or 2. Same thing.

...

Dwarf 1 counts the number of times dwarves 2-9 said white. If odd, say white. If even, say black. He lives.

• 9.5 dwarves. The 10th has a 50% chance (as you said). I'd hate to see half a dwarf running around, though... Commented Aug 21, 2014 at 18:42
• Yeah, but Ross Millikan is right. This is a duplicate. It should probably just be closed. Commented Aug 21, 2014 at 18:51