Puzzle | King Octopus and Servants

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:

  1. Servant A said, “Altogether we have 28 legs.”
  2. Servant B said, “Altogether we have 27 legs.”
  3. Servant C said, “Altogether we have 26 legs.”
  4. 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.

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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 Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.