Answering a question with 100 lines of code is OK in some cases, but not this one.
From How do I ask a good question? in SO's help documentation: "if your problem is with code you've written, you should include some". That obviously applies in the case of the linked question. The OP made vague claims about their code, and they may or may not have written some, but there is no evidence in the question that it actually exists.
So what you should have done instead of answering is ask the OP to update the question with their code. That is a win-win approach:
- If they don't provide the code then vote to close the question with "Needs details or clarity".
- But if they do provide their code then you can show them where they are going wrong, which is much more helpful than simply throwing working code at them with little explanation.
Don't reward bad behavior, because your answer can only encourage others to post poor questions that ask for working code. More generally, answering a bad/deficient question is probably not a good idea.