ML Engineer MasterClass (April) | 6 seats left

The Prisoner Hat Problem

The Prisoner Hat Problem

Problem Statement

The Question

Interview question: There are $n$ prisoners. Each prisoner is independently assigned a hat that is either red or blue, chosen uniformly at random. Every prisoner can see the hats of all other prisoners but cannot see their own. All prisoners must simultaneously announce a guess for the color of their own hat. No communication is allowed once the hats are placed. The prisoners may,...

Unlock the full lesson

Created by interviewers from Google and Meta. Master every concept you need to land your dream role.

All courses — Data, ML/AI & Quant
Unlimited coding submissions
Hands-on projects with real datasets
Detailed solutions in text & video
Monthly content updates
Join Premium