Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Problem Statement
3.
Explanation
4.
Frequently Asked Questions
4.1.
What basic approach should be followed when dealing with logical puzzles?
4.2.
Is there any scenario in which the second person is telling the truth about the above problem?
5.
Conclusion
Last Updated: Mar 27, 2024

The Tribe

Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Speaker
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM
Interview Puzzles

Introduction

In an interview, whether for an SDE or any other position, puzzles are usually asked to check the student's logical capability. Puzzles are a great way to test problem-solving abilities. They are tricky and make you think logically. One of the major reasons why puzzles are asked is to check whether the candidate can be focused and careful under pressure. One of the famous puzzles is The Tribe.

Problem Statement

There are eight planets in our solar system. Mars is one of them. Life is very difficult over there as a result, only a few people live on the planet. The people are divided into two tribes named the Truth Tribe and the Lie Tribe. People belonging to the Truth tribe always speak the truth no matter what, whereas the people of the Lie tribe always lie. You went to Mars, and there you met three people from these tribes. You asked the first person, “Which tribe do you belong to?”. He replied something, but you couldn't understand because of the language. The second person translated to you that the first person is saying that he belongs to the “Lie Tribe”, to which the third person replies that the second person is lying.

You need to tell, which tribe does the third person belong to?

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Explanation

The approach to such problems is to consider every possible scenario. 

Case 1:

Let us assume that the first person belongs to the “Truth Tribe”. If the first person belongs to the truth tribe, they will speak the truth and claim that they are from the “truth tribe”. 

In such a scenario, the second person must be lying as they say that the first person is from the “lie tribe”. 

This means that the third person is telling the truth, and they must be from the “truth tribe”.

Case 2:

Now, let us assume the second possible scenario that the first person belongs to the “Lie Tribe”.

If the first person belongs to the lie tribe, then they will lie and say that they are from the “truth tribe”. 

In this scenario, the second person must be lying as they say that the first person is from the “lie tribe” whereas the first person said that they are from the “truth tribe”. 

This means that the third person is telling the truth, and they must be from the “truth tribe”.

From both the possible scenarios, we can infer that the third person must belong to the Truth Tribe.

Frequently Asked Questions

What basic approach should be followed when dealing with logical puzzles?

When dealing with logical puzzles, we should try to find the answer by considering every possible scenario.

Is there any scenario in which the second person is telling the truth about the above problem?

No, there is no such scenario possible in which the second person is telling the truth because if the first person is from the truth tribe. Then he will say he is from the truth tribe, then the second person is lying, and if the first person is from the lie tribe, even then he will say that he is from the truth tribe, and even then the second person is lying.

Conclusion

In this article, we have extensively discussed the puzzle of The Tribe and how to approach it.

Recommended Readings:


Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, DBMS, System Design, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

Live masterclass