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?