Puzzle | City of Truth and Lies

2.1

Problem Statement
A road is divided into two ways of which one leads to City of truth and other leads to City of Lies. All the people of City of Truth always tell truth and all the people from City of Lies always lie. There are two people standing at the division one from City of Truth and other from City of Lies. You don’t know who belongs to which city. You can ask only one question from any of the two people standing there to determine which way leads to city of truth and which leads to city of lies.

Answer Statement
Ask anyone, “Which city do you belong too?”.
In this case, the person belonging to City of Truth always tell the truth and will tell you the way to his city, while the person belonging to City of Lies will lie and point in the direction of City of Truth.

This article is contributed by Aditya Verma. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

GATE CS Corner    Company Wise Coding Practice

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.

Recommended Posts:



2.1 Average Difficulty : 2.1/5.0
Based on 6 vote(s)










Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.