The goal of Stack Overflow is to be a resource of knowledge for years to come. To achieve this, answers should be written in a generalized manner that appeals to the general programming audience.
If you've left out things that you, or the asker, assume everyone should know, then you may be excluding a lot of people searching for the same answers who may benefit from the extra information.
When an answer is posted quickly, one strategy that you can use is to post an answer that's better than the others. Outright copying is of course frowned upon, but posting a better answer is encouraged and embraced.
If you can think of ways to make your answer better, I encourage you to edit it and improve it. There may be things that the other poster left out that may be helpful. However, at some point, realize that your answer may get too generalized and lengthy. In that case, leave it be. The community is likely to upvote both of your answers.
Remember, just because someone else gains doesn't mean that you necessarily lose. :)
Oh, I should add that, if someone does do something unsavory, like actually really plagiarize another answer, you could do one or more of the following:
- Post a question on meta to get clarification, like you did here.
- Leave a comment to the poster asking them to fix his/her post, politely of course. Sometimes people have good intentions, even if they do wrong.
- Flag the answer using the custom flag reason, and describe the situation to a diamond moderator.