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.
What will be the answer by the dwarf and how will they give the answer?
If the last dwarf seems to take time to answer the question, then it means that the dwarfs in front of him have different colored hats on them. There will be anyway enough time given to the last dwarf to tell the answer.
If he sees the same colored hats in front of him, he will immediately tell the answer.