Sunday 14 August 2016

Anirudh

Puzzle: Heaven or hell

You are standing before two closed doors. One of the doors leads to heaven and the other one leads to hell. There are two guards, one by each door. You know that one of them always tells the truth and the other one always lies, but you don't know who is the honest one and who is the liar.

You can ask only one question to only one of them in order to find the way to heaven. What should be your question so that you can identify the door to heaven?

Answer: Show answer
This is one of the classic puzzles asked in interviews. The question you should ask is "If I ask the other guard about which side leads to heaven, what would he answer?". It should be fairly easy to see that irrespective of whom you ask this question, you will always get an answer which leads to hell. So you can chose the other path to continue your journey to heaven.

Here is the explanation: Let us assume that the left door leads to heaven. If you ask the guard who speaks truth about which path leads to heaven, he would say "left", as he always speaks the truth. So, if the liar is asked what "the other guard - the truth teller" would answer, he would lie and definitely say "right", which is the door to hell.

Similarly, if you ask the liar about which path leads to heaven, he would say "right". Now, when the truth teller is asked about what "the other guard - the liar one" would answer, he would fairly say "right", again the path to hell. So in any case, you would end up knowing the path to hell as an answer. So you can chose the other path as the way to heaven.

Anirudh

About the author →

Anirudh Khanna is a Computer Science student and a geek who firmly believes in the awesomeness of technology! He is a programmer and web designer, also keenly interested in the research of new and innovative ideas in Computer Science.

Subscribe to Geek Factorial via email :