The question was specific and clear about what it wanted, and it provided an example input and expected output that was in line with that explanation. An answerer then provided an answer that provides the expected output for the provided input but doesn't meet the stated requirements; it only works for the one example given. That makes it an incorrect answer.
Editing the question to further clarify that the entirely separate logic that the answerer used is not in line with the stated requirements is perfectly fine. You're not changing the requirements of your question, you're simply explaining why a given approach wouldn't meet those requirements.
Since the answer is clearly wrong, you obviously shouldn't accept it.
The answer isn't "Not an answer". It is an answer, it's just an incorrect answer. You don't flag incorrect answers, you just downvote them.