For example, a riddle question has the main riddle in the post, and below the main riddle, in the same post, there's a spoiler-tagged solution.
Is this okay? What about posting the solution after x hours/days/etc?
If you want to answer your own question, you can do so by posting an answer to your own question (Stack Exchange allows this!).
You should definitely not, however, edit your question to contain the answer.
If you want to post the answer to your own riddle (say if nobody's managed to solve it after a long period), do so in a self-answer instead.