Two Doors, Two Guards, One Question to Live
Two doors: one leads to life, one to death. Two guards, one always truthful, one always lying — you don't know which is which. You may ask exactly one yes/no question to either guard. Which question guarantees you identify the safe door?
People also ask
What is the answer to the two doors, two guards riddle?
Point at either door and ask one guard: 'What would the OTHER guard say if I asked him which door leads to life?' Then choose the opposite door. Both a liar and a truth-teller will point you to the death door, so flipping their answer guarantees the door to life.
Why does asking about the other guard work?
The single question forces the answer to pass through both guards. The truth-teller honestly relays the liar's lie, and the liar reverses the truth-teller's honesty. Either way the reply is always wrong, so the opposite door is the safe one.
Is this the same as the knights and knaves puzzle?
Yes. It's a famous logic puzzle (popularized by the movie Labyrinth and logician Raymond Smullyan) where one figure always lies and one always tells the truth, and you must find the truth with a single clever yes/no question.