A
group of dwarfs (more than 2) spend a considerable amount of time in
a pitch dark grotto. Some dwarfs are wearing a red hats, the
others yellow hats; but each dwarf does not know what the colour of
the hat on his own head is.
When they leave the grotto they have to line up
so that all the dwarfs with red hats stand on one side and those with
yellow hats stand on the
other side of the line. The dwarfs may not take off their hats to check
its colour nor may they communicate the colour of another
dwarfs hat to him.
How will the dwarfs solve this problem?
More colourful
dwarfs.