A riddle was a type of puzzle or mystery that was often baffling. Sometimes a riddle would be part of a guessing game, presented to someone in the form of a question or statement, allowing them to use their brain to decipher it, and make their best educated guess to what the answer to the riddle was.
In 2267, when James T. Kirk asked the Guardian of Forever if it was a life form or a machine, it said: "I am both – and neither. I am my own beginning, my own ending." Spock questioned why the Guardian must speak to them in riddles but the Guardian told them that he only was speaking in a manner that they could comprehend. (TOS: "The City on the Edge of Forever")
In 2269, when the USS Enterprise and the IKS Klothos were pulled into Elysia by the Delta Triangle, they attempted to escape, even though many others trapped there had long ago given up such attempts. Magen described the presumed futility of their attempts, saying "two new ships. In each, beings labor to solve the riddle The riddle of the time trap escape." (TAS: "The Time Trap")
In 2270, Kukulkan left a riddle for the crew of the Enterprise, in the form of his city. They discovered that the four serpent-head pillars on each corner of a giant pyramid had to be arranged a certain way relative to the sun to complete the energy amplification device that served as the transmitter. (TAS: "How Sharper Than a Serpent's Tooth")
In 2376, Neelix presented Tuvok with a humorous riddle about an ensign faced with starvation on a Class L planetoid, and all he had was a calendar. He asked Tuvok how he survived, and Tuvok decided that it would be impossible. But Neelix told him the answer to the riddle; that he ate all of the "dates" on the calendar. Tuvok was not impressed with the riddle which he said was nothing more than word play. (VOY: "Riddles")