Just ask any one of them the following question:
If you were the opposite to what you are going to be when you answer this question, which would be the right way to go?
If he’s the indecisive type in lying mode, he’ll have to tell you to go the wrong way because, as a truth teller he’d have to tell you the right way but, since he’s lying, he won’t.
If he’s the truth-teller (or an indecisive type in truth mode), he’ll have to tell you to go the wrong way because, as a liar, that’s what he’d say.
Then just go the other way. No algorithm required, just an O(1)
calculation.
Made CW since it’s not really a programming related question.
3
solved Optimal Algorithm [closed]