There are 20 Dwarfs in a Mine. A Dwarf is wearing a red or a blue helmet but they don't know what color they are wearing. At 17:00 the dwarfs are coming out of the Mine and now they have to stay always next to each other with the same helmet colors like: The red Dwarfs next to each other and the blue dwarfs next to each others.

The Problem is, that they can't speak together and they also can't point somewhere. So every dwarf has to decide on his own where he is going to stay.

How is it possible that they made two correct groups out of blue helmet dwarfs and red helmet dwarfs?


Some more Rules: The dwarfs are not coming out of the mine together this means that the first dwarf is not seeing any other dwarf he will stay at any point he want to then the second dwarf is only seeing the helmet of the first dwarf and so on.

Which means that the last dwarf is able to see if there are two correct groups or not because he sees all the colors of the other dwarf helmets.

The Dwarfs are not able to look in a mirror to see there color and they can't take there helmet off to see it.

I think with this inputs you can find a strategy to solve this problem

  • 1
    $\begingroup$ This could use a little clarification. Can all the dwarfs see all the other dwarfs? Can they get together into groups one way, then another, then another, and eventually stabilize, or is it (e.g.) that as they come out they have to turn left or right and make consistent choices? Do they have any other interaction while they're in the mine? $\endgroup$
    – Gareth McCaughan
    Nov 15, 2017 at 15:40
  • $\begingroup$ (From your comments on Mnemonic's answer it seems as if maybe the scenario is this: they come out in single file and each gets to see the dwarfs in front but not the dwarfs behind, and somehow each needs to choose only on the basis of what they see then. But that seems obviously impossible.) $\endgroup$
    – Gareth McCaughan
    Nov 15, 2017 at 15:42
  • $\begingroup$ I will classify a bit one sec $\endgroup$ Nov 15, 2017 at 15:42
  • $\begingroup$ I assume, of course, that they aren't allowed to take off their own helmets or look in a mirror. But it might be worth making that more explicit too :-). $\endgroup$
    – Gareth McCaughan
    Nov 15, 2017 at 15:43
  • $\begingroup$ @GarethMcCaughan no it's not allowed to take off there helmet and look :) $\endgroup$ Nov 15, 2017 at 15:47

3 Answers 3


They can:

stand in a queue with their shoulder sideways. As the second dwarf will come, he will stand in side with the first dwarf. Then the third dwarf will come , if both the first and second dwarf are wearing the same helmet he will stand by side of either first/second dwarf and if they are wearing opposite colored helmets, third dwarf will stand in between first and second dwarf. And So on... This will split them into two groups. Although I am not sure about how the last dwarf will sort himself.

  • $\begingroup$ Please hide your anwser that you are not spoilering $\endgroup$ Nov 15, 2017 at 15:51
  • 3
    $\begingroup$ This gets the red helmets all together and the blue helmets all together but doesn't really split them into two groups. If this is the intended solution then maybe the question should be revised a little. $\endgroup$
    – Gareth McCaughan
    Nov 15, 2017 at 15:51
  • $\begingroup$ @GarethMcCaughan was thinking the same. Last dwarf will never know which group he belongs to. $\endgroup$
    – prog_SAHIL
    Nov 15, 2017 at 15:52
  • $\begingroup$ Yes i tried to show this with this explanation of group: The red Dwarfs next to each other and the blue dwarfs next to each others This makes this anwser possible or am I wrong? I knew im on a small path with this... $\endgroup$ Nov 15, 2017 at 15:55
  • $\begingroup$ Once the last dwarf comes out, there will be a dwarf at one of the ends with the same color as the last dwarf. This dwarf can then walk somewhere else. The last dwarf, and everyone between that dwarf and the dwarf at the end, can follow. $\endgroup$ Nov 15, 2017 at 16:09

Each dwarf can

Go into group 1 if it sees an even number of red helmets and group 2 if it sees an odd number of red helmets.

This works because

If there are an even number of red helmets, all the dwarves in red helmets will see an odd number, and all the dwarves in blue helmets will see an even number, so they will end up with two separate groups. It similarly works if there are an odd number of red helmets.

  • $\begingroup$ So nice idea but not correct the problem is, that you don't know how many dwarfs are wearing a blue helmet oder a red Helmet It is possible that there are 15 red helmet dwarfs and 5 blue helmet dwarfs or 19 red helmet dwarfs and 1 blue helmet dwarf $\endgroup$ Nov 15, 2017 at 15:20
  • $\begingroup$ If there are 15 red helmets and 5 blue helmets, then everyone with a red helmet will see 14 red helmets and go into group 1. Everyone with a blue helmet will see 15 red helmets and go into group 2. If there are 19 red helmets, then everyone with a red helmet will see 18 red helmets and go into group 1 and everyone with a blue helmet will see 19 red helmets and go into group 2. So this works. $\endgroup$ Nov 15, 2017 at 15:27
  • $\begingroup$ Yeah but the problem is that in the beginning there are 20 dwarfs somwhere in the mine and there are no groups so the first dwarf is coming out and staying somwhere then the second dwarf is coming and maybe he is staing next to the other dwarf or somwhere else the the third dwarf is coming and is staing somwhere and the question is how do the have to stay and where do they have to stay that this is working? $\endgroup$ Nov 15, 2017 at 15:37
  • $\begingroup$ On what basis Group1 is formed/created? $\endgroup$ Nov 15, 2017 at 15:46
  • $\begingroup$ @MeaCulpaNay This was written on the assumption that all dwarves could see each other. The question has been clarified to say that isn't the case. $\endgroup$
    – user27014
    Nov 15, 2017 at 15:52

Mnemonic's answer is pretty elegant, but here's an additional solution if they aren't allowed to strategize beforehand:

Group together in clumps of three. Any dwarf that sees two different colors in their clump leaves their clump. By seeing whether the other two leave the clump, they learn what color their helmet is.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.