This was triggered by the handling of the following questions:
The first one had broken code and thus got put on hold, and any later tries to amend it by the OP got shut down because it already had 2 answers.
In the second question, the OP finally posted working code - only to get marked as a duplicate of the old one with broken code.
I'm asking since this was clearly the first attempt of said OP to post a question on this site, and he tried to amend it complying with the moderator's advice on the first question (create a new one with working code).
How should one fix a question in order to make it adhere to Code Review guidelines without getting marked as duplicate, even when the flaws of the original question were amended?