You've successfully subscribed to Nicholas Workshop
Great! Next, complete checkout for full access to Nicholas Workshop
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Card Guessing

Nicholas Wong
Nicholas Wong

Question

Consider there are 4 blue and 4 red cards. Host gets 2 cards randomly, no one knows what cards they are. Then he places 2 random cards at the forehead of each player A, B and C. Players do not know the color of their own cards, but know those of other players. They have to guess what cards they have. A said he do not know, B said he do not know, then C said he do not know. Then A said he knows now. Please explain the logic how did A get it.

Solution

First, we to think about the situations of all players. In what condition a player knows or does not know his own card? There are 2 of them.

  1. A must have RedRed if all cards of B and C are Blue (B has BlueBlue and C has BlueBlue).
  2. A must have BlueBlue if all cards of B and C are Red (B has RedRed and C has RedRed).
  3. A won’t know what cards he has if cards of B and C have at least one different color (all other situations beside 1 and 2).

Repeat this logic to players A, B and C. Since all of them don’t know what cards they have (situation 3), this implies all players has RedBlue cards. Therefore A knows he has RedBlue cards.

Algorithm

Nicholas Wong

Fullstack software engineer with strong background in computer science and extensive experience in software engineering and architecture. Studied in NYU, worked in Yahoo, Rakuten and Manulife.