If you give a correct answer, but someone gives a hint in a comment on how at a certain step in the solution a different approach would have shortened your answer, what is the best way to edit your answer? I have been adding an addendum under the old answer with the heading "Edit:", but I don't know whether it's better to just edit the entire thing and only give the newer streamlined answer?
The purpose of writing answers is to explain something. It is not to give a chronological report of how your thoughts went, and how you interacted with a commenter. So, the answers should be optimized with the former goal in mind. Rewrite as many times as needed, and as thoroughly as needed.