What will be the answer by the dwarf and how will they give the answer? Evil warlock dislikes dwarfs and therefore he selects four of them and buries them. The dwarfs are buried in the ground and they are in such a way that except their heads their body is inside the ground. The dwarfs cannot move their body and they can view only forward. They are all buried in a line, and amongst the four, one of the dwarf is separated by a wall. All the dwarfs are in the same direction. The last dwarfs can see two heads of the friends in the front and a wall. The last second dwarf can see one head of his friend and a wall. The second dwarf can see only the wall. The dwarf can see nothing. Warlock comprehends the situation and tells the dwarfs that he has placed hats on their heads. There are two blue hat and two red ones. In all the four dwarfs, one of them has to say what color hat he is wearing. If the dwarf says the correct color of the hat, they will be left free. If the answer is wrong, then they will be dig inside the ground till the very end.



If the last dwarf who can see the 2 heads does not know the answer to what hat he is wearing it means the 2 dwarfs in front of him have different color hats on. The second to last dwarf can use that the last dwarf doesn't answer to determine that and answer that we are wearing the opposite color hat of the dwarf in front of him.
1 5 1