LibraryQuant brainteasers

Prisoners Hats in a Line Parity Strategy

Quant brainteaser · medium · members

The question

A hundred prisoners are lined up single file, all facing the same direction. Each wears a hat, either black or white, assigned in any combination by an adversary who knows the strategy the prisoners are about to agree on. Each prisoner can see the hats of every prisoner in front of them, but not their own, and not any hat behind them.

Starting from the back of the line and moving forward, each prisoner in turn must, loudly enough for everyone to hear, guess their own hat colour. Every prisoner hears every guess made before their own turn, but hears nothing else, no signals, no gestures.

The prisoners may agree on a strategy in advance, but not after the hats are placed. Devise a strategy that guarantees the maximum possible number of correct guesses.

Hint

Each spoken guess is heard by everyone further forward. Ask what a guess could tell the listeners, apart from the speaker's own colour.

The worked solution is for members

You have the question and a hint. It gives a strategy for the whole line, counts how many prisoners it is guaranteed to save, and shows why no strategy can do better.

Further reading

Topics

Also in the library