My take on this: I wouldn't worry about it. If you start writing an answer and someone beats you to it and they happen to give the essential same answer as you, then just pot your answer. Math.SE isn't a competition about who can write the quickest answer. Indeed, I wouldn't even view it as a competition among the answerers. It is about providing good answers to good questions. If two answers happen to be similar, then ok. I don't see who would get hurt in such a case.
Now, if a question already has an answer and you show up 2 hours later, then I wouldn't post another answer unless you believe that you can add something. You can still provide what is essentially the same answer, but maybe you can word things a bit differently.
As a teacher, you can sometimes get surprised at how saying things only slightly different can make a big difference for the student.
So, as long as you don't purposefully copy someone's answer, then just post your answer.
As is addressed in this question/answers: Related: Letting less-reputable people answer questions I also wouldn't be discouraged by more "reputable" users posting perfect answers quickly.