Please check this question which was migrated from SO. When I go to the original post in SO, I see that my answer is deleted. And a link to FAQ why the answer is deleted. I understand the reason of deletion. My answer is exactly the same logic of another answer which was posted before me, and thus my answer is not adding anything valuable.
Now this is what actually happened. When I saw the question I started to write some code to test my logic. When I came back to browser I saw the notification that 3 new answers are posted. Instead of refreshing the page I posted my answer. Then I saw that another answer is of exactly the same logic, the only difference is that was written in Python like pseudo code, and mine was written in C. So I decided to keep my answer.
Now my concern, does that mean I was trying to cheat? Please note that if the community decides that my answer should be deleted then I have no objection against the SO community. I am only curious what should I do in similar cases.