** Puzzle:** There was a water kingdom where lived a king octopus with his few servants. The servants either had 6, 7 or 8 legs. It is known that:

- 7 legged servant always lied.
- 6 and 8 legged servants always said the truth.

One fine day, four servants gather before the king and they came up with 4 statements:

- Servant A said, “Altogether we have 28 legs.”
- Servant B said, “Altogether we have 27 legs.”
- Servant C said, “Altogether we have 26 legs.”
- Servant D said, “Altogether we have 25 legs.”

How will King Octopus find the truthful speaker?

** Solution:** As we can see that the four are making different statements and since one of them speaks the truth that means three of them are definitely lying. This forms the base of our argument.

**Step 1:**So, the three lying servants must have 7 legs each, resulting to 21(7 + 7 + 7) legs.**Step 2:**Now the fourth servant who is speaking the truth must have 6 or 8 legs.- Adding 21 to 6 gives 27 legs.
- Adding 21 to 8 gives 29 legs.

**Step 3:**Since 29 legs are out of the options, so it is proved that the 27 legs are the correct answer and Servant B is the truthful one.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.