The riddled propounded by the sphinx was: "What creature walks on four legs in the morning, two legs at noon, and three legs in the evening?"
Oedipus, a wanderer who was not aware of the Sphinx's torment resolved the riddle by answering "Man". As a crawling infant, man walks on four legs; as an adult, he walks upright on two legs; and in old age, he supports himself with a cane, effectively using three legs.
Upon correctly answering the riddle, the Sphinx was vanquished, and Thebes was relieved from its misery and threat.