There are N prisoners, but there is not enough space for all of them. The jailer decides to give them a test, and if all of them succeed in answering it, he will release them, whereas if any one of them answers incorrectly, then he will kill all of them. He describes the test as follows:
I will put a hat, either white or black, on the head of each of you. You can see others' hats, but you can't see your own hat. You are given 20 minutes. I will place at least one white hat and at least one black hat. All of you should tell me the colour of the hat on your head. You can't signal to others or give a hint or anything like that. You should say only WHITE or BLACK. You can go and discuss for a while now.
All of them go and discuss for some time. And after they come back, he starts the test. Interestingly, each of them answers correctly and hence all are released.
The question is, what strategy could the prisoners have applied??