A room of Liars and Truth-Tellers

discrete mathematicslogicpuzzle

Imagine that there are $N$ people in a room.

Each person is either a Liar (always lies) or a Truth-Teller (always tells the truth).
Additionally, each person in the room knows whether someone else in the room is a Liar or Truth-Teller.

How many questions should be asked to them (individually) to determine the number of liars in the room?


Clearly, one should "ask the right questions" in order to minimize the number of questions asked.

Best Answer

You need to ask $O(log_2 N)$ questions of one individual.

Pick a random person and ask the person an obviously true question, e.g. "Is 1 = 1?". The person's answer determines if the person is a Liar or a Truth teller. Now proceed to ask the person the questions asked in a Binary Search algorithm. Negate the person's answer if the person is a Liar.