A criminal is accused of a crime and has to choose between two doors. Each door is guarded by a trained security guard, one who is always truthful and one always lies. One guard is guarding a door leading to freedom, the other guards the door to prison forever. The criminal can ask only one question to either guard. What does he ask?
He goes up to one guard and asks " If I ask the other guard which door leads too freedom, what will he say?" he then goes into the opposite door.
So if he asks the lying guard the guard, the guard would say the prison door, because he lies. But if he asks the truthful guard, knowing his companion would lie, points to the prison door.