If I ask a question on SO and someone comments on it, not solving the problem, but leading to my solution nonetheless, what is the best way to handle assigning the correct answer? I could just answer it myself with a full explaination, but at the same time, I wouldn't have solved the problem otherwise. What is the best way to handle credit in such a case?
Just answer it; there's no further ceremony or citation needed.
Answers posted in comments are a big problem because comments do not support features like proper voting and the wiki-style editing that allow us to edit and improve that content. They will probably be deleted anyway (or at least they should).
Yes, every once in awhile, a "half-answer comment" might spur a real answer to be posted, but the problem remains that that all those unfinished, unvetted answers-in-a-comment remain very conspicuously at the top of the thread where the voting is supposed to determine which answers rises to the top. Unfortunately, incoming users wont likely understand that nuance between a proper answer and one that is "just a comment."
Personally, I don't like an answer bulked up with a lot of needless backstory and commentary. Something that starts, "according to this comment [link], so and so said… which got me thinking…" just buries the actual answer under a lot of unnecessary verbosity. I would just answer the question with something awesome and don't worry about the comments from folks who didn't have the time nor the inclination to post a proper answer.