A quick search reveals that this hasn't really been answered before, so...I have this problem that I came up with and solved offsite. However, I still want to post the problem as a question and then the solution as an answer shortly after. What's the policy on this?
It's allowed (see the paragraph immediately above "What kind of questions should I not ask here?" in the main site FAQ), especially if you're open to suggestions on your answer and/or improved/alternate answers. Personally, I'd suggest composing your answer ahead of time, to whatever extent possible, so that you can post your own answer almost immediately after the question, letting others know that you have an answer for it.