I just came across this question. The asker has found the answer themselves and edited the question with the solution. Usually under these circumstances, the person would add an actual answer to their question.
I am unsure how something like this should be handled.
My only thought was that I could edit the question to remove the answer and add it as an actual answer for the question as a community wiki. My hesitation in doing this is that if I came across this question before the answer edit, I most likely would have attempted to flag it as low quality because the code that they have there is invalid.
So, I was just wondering what the broader community thinks should be done in a scenario like this.