Interview Question


Country: India




Comment hidden because of low score. Click to expand.
13
of 15 vote

Ask one of the guard:" what would the other guard say if i ask him which way is the hell?"
And whatever answer he gives that is the way to heaven.
Explanation:
If you end up asking the question to the truthful one, he will tell the true and he knows the other guard is going to lie so he will so the way to heaven.
If you end up asking the question to the liar he will lie what the answer will be and he lies and instead shows the way to heaven.

- nirojpokhrel November 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 votes

Correct !

- Buzz_Lightyear November 22, 2012 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

BRILIANT! both the answer and the question

- Anonymous February 22, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 2 votes

I do not believe that this answer will help find the right gate because:
If i ask the truthful guard "what would the other guard say if i asked him which one is hell?" he would say that the liar will point in my direction.

But if you ask the liar "what would the other guard say if i asked him which one is hell?" he would say that the truthful guard will point in my direction.

We don't know which guard is guarding which gate.

- Anonymous February 22, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

@Last Anonymous: I don't understand your argument. The liar and truthteller will point to the same door, regardless which one you ask. That allows you to determine the correct door.

- eugene.yarovoi February 24, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Here's a famous scene from the movie "Labyrinth" that features this problem: youtube DOT com/watch?v=2dgmgub8mHw

- eugene.yarovoi February 24, 2013 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Correct! Thanks....took a lot of thinking though.

- Nick May 08, 2013 | Flag
Comment hidden because of low score. Click to expand.
4
of 4 vote

Ask one of them: "Does the gatekeeper guarding the gate of heaven always speak the truth?"
If the gatekeeper says "No", the other gate is the gate to heaven. If he says "Yes", the gate he is guarding is the one.

Case 1:
Heaven gatekeeper speaks the truth and Hell's gatekeeper lies.
As per our question, Heaven's gatekeeper will reply "Yes",

Case 2:
Heaven gatekeeper lies and Hell's gatekeeper speaks the truth.
In this case, Heavens gatekeeper will again reply "Yes"

- abhinavchdhry November 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Correct!

- Vbhattar November 22, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@Travis: how do u know that a truthful one guarding the heaven gate.
there is no certainity for that. The liar may be guarding the heaven gate..

- Billy February 06, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

it is not mentioned that the truthful person guards the gate to heaven

- resha April 10, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 7 vote

Ask "are you a gatekeeper?"
Heaven will say "yes".
Hell will say "no".

- Travis November 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Simplest possible answer. Amazing Travis.

- Vikas November 22, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

How will this tell that which is the gate to heaven?

- Chirag November 22, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

All you did was to find which one is a liar.

- Rayden November 22, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

You'd need another question to actually determine who's guarding the gate to heaven. You've assumed that the one guarding heaven is the truthteller, but there was no such constraint.

- eugene.yarovoi November 22, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

What Travis is presuming i guess is that God will not allow a liar to guard the doors to heaven (i wish it was Stairways to Heaven instead) :P

- The Artist November 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

You are correct, Rayden, eugene. My mistake.

- Vikas November 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@The Artist That's what I was thinking. I was taking the question too literally.

- Travis November 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Can't we ask "Is god there"?

- dinnu.k December 03, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

We can't ask "Is God there?" because they'll both say yes.

- Dan December 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

why ask such complicated things?
simply ask 2+2=?
if he says 4, heaven, something else, hell

- Anonymous October 30, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

There are no guarantees about which guard is guarding which door.

- eugene.yarovoi October 31, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

The problem does involve 2 gatekeepers. One always lies and one always tells the truth. The solution to the problem is to ask either of the gatekeepers which door the other gatekeeper would say leads to heaven. Then, you choose the other door.

Here is the reasoning: If you happen to ask the gatekeeper who always lies, he will point to the door to hell because he knows the other truthtelling gatekeeper would point to the door to heaven. If you happen to ask the truthtelling gatekeeper, he will also point to the door to hell because he knows the gatekeeping liar would say the door to hell is the door to heaven. So, in either instance the gatekeeper points to the door to hell and you can safely choose the other door.

- Snow121 June 02, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Brilliant answer !

- dove November 29, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Thanks a lot, tha's brillant!

- Leonardo Arias October 04, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ask them both, does god live here?

- Chard1879 May 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ask a gate keeper, if you are alive is true this door is entry for hell is also true. Pls confirm.

- puzler January 09, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

"What have I got in my pocket?" No, no. Wrong scenario.

"What walks on 4 legs in the morning, 2 legs in the afternoon and three legs in... nope, not that one either.

Erm... "Knock, knock?" Hmmmm....Oh, dear.

I know! "Hey, did you know that the other guardian says he can kick your arse?" Then while they're fighting, peek inside each gate and pick the one that looks like Heaven. Hah!

- cpc65 May 04, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

"What have I got in my pocket?" Wait. Wrong scenario.
"What walks on 4 legs in the morning, 2 legs in the afternoon and 3 legs in...." No, not that one either.
"Knock, knock?" Nope. Hmmm.
Oh, I know! "Hey, did you know that the other guardian said he could kick your arse?" Then while they're fighting you peek through each gate.

- cpc65 May 05, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ask him: "If I ask you: 'Are you guarding the heaven gate'? what would you answer?"
If he responds 'yes' then this is the heaven gate; hell otherwise.

Possibilities:
1. This is heaven gate and he is the truth teller. He will answer 'yes'.
2. This is heaven gate and he is the untruth teller. If you were asking this, he would reply 'No' (as this is lie), but if you ask him what he would reply, he will lie again and say 'yes.'
3. This is hell gate and he is truth teller. He will answer 'No'.
4. This is hell gate and he is liar. He would answer 'yes' to the original question, and he will lie and answer 'No' to your question.

So in any case they will both say 'yes' if this is heaven and 'no' otherwise.

- Leo July 28, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I would ask, I am god, please show me heaven door?, 100% correct answer with the below 4 cases. Since I have a chance to ask either guy once, I will get response only from one guy in every case I am a winner.

Case 1:
Hell door-> Truth guy: No you are not god but the other door is way to heaven.
Heaven door-> False guy

Answer: since he said I am not god, I will know he is the truth guy pointing me towards heaven correctly.

Case 2:
Hell door-> Truth guy
Heaven door-> False guy: Yes, you are god, the other door is way to heaven.

Answer: Since he said I am god, I will identify him as a false guy and not other door is way to heaven but his door is.

Case 3:
Heaven door-> truth guy:you are not god but my door is way to heaven.
Hell door-> false guy:

Answer: Answer: since he said I am not god, I will know he is the truth guy pointing me towards heaven correctly.

Case 4:

Heaven door-> Truth guy
Hell door-> False guy: Yes, you are god, the my door is way to heaven.

Answer: Since he said I am god, I will identify him as a false guy and not his door is way to heaven but other guy door is.

Please let me know how is my answer? Thanks!!

- chandrakanth December 03, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I would ask, I am god, please show me heaven door?, 100% correct answer with the below 4 cases. Since I have a chance to ask either guy once, I will get response only from one guy in every case I am a winner.

Case 1:
Hell door-> Truth guy: No you are not god but the other door is way to heaven.
Heaven door-> False guy

Answer: since he said I am not god, I will know he is the truth guy pointing me towards heaven correctly.

Case 2:
Hell door-> Truth guy
Heaven door-> False guy: Yes, you are god, the other door is way to heaven.

Answer: Since he said I am god, I will identify him as a false guy and not other door is way to heaven but his door is.

Case 3:
Heaven door-> truth guy:you are not god but my door is way to heaven.
Hell door-> false guy:

Answer: Answer: since he said I am not god, I will know he is the truth guy pointing me towards heaven correctly.

Case 4:

Heaven door-> Truth guy
Hell door-> False guy: Yes, you are god, the my door is way to heaven.

Answer: Since he said I am god, I will identify him as a false guy and not his door is way to heaven but other guy door is.

Please let me know how is my answer? Thanks!!

- chandrakanth December 03, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I would ask, I am god, please show me heaven door?, 100% correct answer with the below 4 cases. Since I have a chance to ask either guy once, I will get response only from one guy in every case I am a winner.

Case 1:
Hell door-> Truth guy: No you are not god but the other door is way to heaven.
Heaven door-> False guy

Answer: since he said I am not god, I will know he is the truth guy pointing me towards heaven correctly.

Case 2:
Hell door-> Truth guy
Heaven door-> False guy: Yes, you are god, the other door is way to heaven.

Answer: Since he said I am god, I will identify him as a false guy and not other door is way to heaven but his door is.

Case 3:
Heaven door-> truth guy:you are not god but my door is way to heaven.
Hell door-> false guy:

Answer: Answer: since he said I am not god, I will know he is the truth guy pointing me towards heaven correctly.

Case 4:

Heaven door-> Truth guy
Hell door-> False guy: Yes, you are god, the my door is way to heaven.

Answer: Since he said I am god, I will identify him as a false guy and not his door is way to heaven but other guy door is.

Please let me know how is my answer? Thanks!!

- chandra December 03, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think most of us are getting confused with the question wording: " what is the way to heaven" instead the question wording would be when asking the question to both the guards is : " If i ask other guradian for the way of heaven, what would he tell me"

This is the exact question, you can find a video on youtube as well with descriptive answer....

- Anonymous December 06, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Heavan gate keeper give a direct answer hell gate keeper beats around the truth so the question i ask heaven or hell to both gate the one who talks to much is hell the one who quite is heavan cause he cant lie

- Anonymous August 08, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Its easy the gate keepers i will ask how old am i. Allways ask them some thing no one knows but god and walk in heavan narrow gate goes to heavan

- Ivy August 08, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Assume G1 in (left,=hell) and G2 (Right=Heaven).
Ask G1 which way leads to heaven.
As he always lies he say Left.

Then ask to G2 Which way leads to hell.

As he always speak truth so he say left.
That means we have to go in right side.

How's it?

- Anonymous September 15, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Only think that brings you to the heaven is that how much good your work is in earth because no one is smarter than God if you ask lier gatekeeper where the gate to hell he lies and shows way to heaven but problem is that you don't know who is lier and who is truth.

Conclusion
The answer of both guards are opposite so only your luck will save you

- Undertaker April 01, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Go up to one guard and say "In the hypothetical situation that I asked you if you were guarding the gate to heaven, would you say "yes" or "no"? The guard who always tells the truth will say "yes," because his answer to your question will be truthful, and the true answer is "yes." The guard that lies will say "no," because in actuality he would answer "yes" to the stated question, but he can't tell you he would answer "yes," because that would be telling the truth.

- Gilgamesh October 30, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if we ask the question "What is 1+1"

- hari June 18, 2022 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ask one of them " If the person guarding the gate to heaven is a gatekeeper? "

If the gatekeeper is the liar, gatekeeper's answer will be No, and you that other gate is the gate to heaven.

If the gatekeeper is the truthful one, then gatekeeper's answer will be yes and you that the same gate is gate to heaven.

- Abhishek Verma November 26, 2023 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Simplest possible answer :-"Are you a human being"
the liar will say no
while the true man will say yes!

- Vaibhav March 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

But then, you only know which guard is the liar. You don't know anything about which door is the door to heaven, and you're all out of questions.

- eugene.yarovoi March 24, 2013 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Its simple .. it does not say that they look alike .. so the heaven's gatekeepar will look decent as compared to hell's .....

- Hrishikesh April 23, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

u cant solve this, if u have n problems you need 2^n answers to fully solve it so this is your answer. u cant

- Darlington July 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

since the truth is heaven and the lie is hell u ask one of them "if i ask the other guard what gate he's guarding, what will he say?" if they say heaven then go in that one. if they say hell go in the other one.
explained: neither would say that they are guarding hell. therefor the one who supposedly is guarding hell is guarding heaven.

- Anonymous August 15, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Look for tattoos and go to the other door.

- dc August 05, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

Ask "What would Jesus do?"

- Foster January 20, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 4 vote

Couldn't you just ask: "Is my name [insert name here]?" The liar will say "no".

- LadyAlice March 05, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Yes, you could. But then, you only know which guard is the liar. You don't know anything about which door is the door to heaven, and you're all out of questions.

- eugene.yarovoi March 05, 2013 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More