The same principle applies when someone else has the same idea as you at the same time, and you catch wind of it right in the middle of your implementation of that idea. It might be slightly more difficult, since you arrived at the same good idea independently of each other. Just focus on executing better.
Ideas are a dime a dozen - they aren't worth anything in and of themselves.
If they blatantly copy your code, as is the case here, then it becomes slightly worse, an actual legal issue. But again I wouldn't worry too much since I'm willing to bet that they aren't that good at coding either.