aspose file tools*
The moose likes Programming Diversions and the fly likes Life door or Death door Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Life door or Death door" Watch "Life door or Death door" New topic
Author

Life door or Death door

Rakesh Joshi
Ranch Hand

Joined: Feb 24, 2006
Posts: 218
DOOR A DOOR B
GUARD A GUARD B

There is a prisoner who is about to be executed. The king decides to give him one last chance to live.

There are 2 doors, the life door and the death door. There is one guard standing by each door. Those two guards know which door is the life door and which is the death door. However, one of them always tells the truth and the other always tells a lie. There is no way you can identify which door is the life door or the death door. There is no way you can distinguish who is the one telling the truth.

The prisoner can only ask one guard one question. Then he needs to choose a door to walk in. If he walks in the death door, then he will be executed. If he walks in the life door, he can have a new life.

He did choose the life door and lived. What was the question he asked? How did he choose the door after he got the answer from one of the guards?


Life is a Game play it.
Rakesh Joshi
Ranch Hand

Joined: Feb 24, 2006
Posts: 218

ankit tuteja
Greenhorn

Joined: Nov 30, 2005
Posts: 7
you tell us naa please
Peter van de Riet
Ranch Hand

Joined: Apr 09, 2004
Posts: 112

Originally posted by Rakesh Joshi:
What was the question he asked? How did he choose the door after he got the answer from one of the guards?

Question to guard A: What will guard B say when I ask him if door A is the way to live?
You have to take the other door to survive.

[ March 30, 2006: Message edited by: Peter van de Riet ]

Each number system has exactly 10 different digits.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Life door or Death door