Two doors, two guards, one question
product-puzzle case · difficulty 2/5 · 15 minutes · other
Prompt
There are two doors: one leads to heaven and one to hell. Each door has a guard. One guard always lies and the other always tells the truth, but you do not know which is which. You may ask one question to one guard. What do you ask to find the door to heaven?
Context
A classic interview puzzle. Core idea: Ask: 'If I asked the other guard which door leads to heaven, what would he say?' Then take the opposite. Talk through your reasoning; the interviewer cares as much about structure as about the answer.
Clarifying questions
- Do you know who is who?
- No, you do not know which is which. You may choose either guard and ask any single question.
Recommendation
**Answer:** Ask "Which door would the other guard say leads to heaven?" and go through the other door. **Why:** Nesting the question makes the lie and the truth combine into one predictable inversion, so you do not need to know who is who.
Risks
- Asking a direct question such as "Which door leads to heaven?", whose answer you cannot interpret without knowing who is the liar
- Forgetting to choose the opposite door at the end
Next steps
- Solve the yes-or-no version of the question
- Think about what changes with three guards: one truth-teller, one liar and one who answers at random