There is prison.
Imagine there are 100 prisoner in that prison including you.
One fine day the inspector comes and sets up a challenge for all of the 100 prisoner.
The challenge is that he will make you stand on a stair case which has 100 stairs.
Assume that you are on the 100th stair or the top most stair and the others are on the remaining stairs.
The inspector comes and put either a black or white hat on all of the prisoner. You have been told that there are only black and white hats but not told the number of black or white hats.
Then the inspector asks starting from you as your on the top that "What is the color of hat that your wearing?"You are either allowed to say black or white nothing else. Prisoners are not allowed to see there own hat nor they are allowed to see the hat of the prisoner behind him.
Each prisoner is only able to see the hats of the prisoners who are standing in front of him.
If your answer is correct then you are set free from the prison.But if your answer is wrong then you are killed.
Each prisoner is able to here the answer of all the other prisoner. All the prisoner including you are told about this challenge one day before. Thus you have to plan a strategy such that maximum of you all are set free and not killed.
So the question is "What is the maximum number of people you can save?"