← Bank of America Interview Insights
I'd seen hat puzzle variants before but not this exact setup, so I spent the first minute just restating the problem back to myself out loud which probably looked weird.
First, clarify the rules: each prisoner sees all other hats, and they must all guess simultaneously or can they strategize beforehand? Then, recognize that with 7 colors and 7 prisoners, a modular arithmetic strategy can guarantee at least one correct guess. Explain the strategy: assign each color a number 0-6, each prisoner computes the sum of the other hats modulo 7, and guesses the color that would make the total sum equal to their assigned number.
Pro tip: Mention that this is a classic error-correcting code problem: the strategy ensures exactly one prisoner guesses correctly, and it's optimal because no strategy can guarantee more than one correct guess when all guesses are simultaneous.
Ask if prisoners can communicate after seeing hats, if guesses are simultaneous, and if they can agree on a strategy beforehand. Assume they can strategize beforehand and guesses are simultaneous.
The goal is to guarantee at least one correct guess. With 7 colors and 7 prisoners, a deterministic strategy can ensure exactly one correct guess.
Number the colors 0 through 6. Assign each prisoner a unique number from 0 to 6 (e.g., prisoner i gets number i).
Each prisoner computes the sum of the colors they see modulo 7. They guess the color that would make the total sum of all hats congruent to their assigned number modulo 7.
Show that the actual total sum modulo 7 equals exactly one prisoner's assigned number, so that prisoner guesses correctly. Also argue that no strategy can guarantee more than one correct guess because the total sum is unknown to any single prisoner.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.