As seen in this question, the OP answered instantly (the timestamps are the same) to his question. I left a (barely mean) comment and I downvoted the answer, but what is the appropriate behavior with this kind of reputation-grinding?
Asking and answering your own question is encouraged in general on the Stack Exchange network.
Here on Stack Exchange, it's explicitly encouraged to ask and answer questions you've encountered and managed to find an answer to - that way, other people with the same question can find the answer.
It's an actual feature of the site that when you go to post a question, you can tick a checkbox to answer your own question, and you'll be able to write both the question and the answer at the same time, directly from the "Ask a Question" interface, and then post them at the exact same time. There's also a blog post about it, going into more detail.
Puzzling.SE is a bit odd, though - most questions here the OP knows the answer, and is providing a challenge to the rest of the community, so this feature is very rarely used here.
In this specific case, I don't think it's too big of a deal. The OP found a puzzle (of sorts; discussing whether it's on topic or not is an entirely different question), solved it, and decided to share it with the Puzzling.SE community. They also provided the answer they came up with at the same time, the same as they would if the puzzle was posted directly to Puzzling.SE.
Posting the question and answer at the same time in this case is not the problem. It's debatable whether or not it qualifies as a puzzle, but that's out of scope of this meta question.