My solution is:
I tested it right in my own IDE, but was told wrong when I submit. Can someone please tell me why?
That's not a solution and it's not in place. If you really wanna make it work copy contents of your solution over the old array. Also with sets you have no guarantee that the order will be preserved. Think about it a bit
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.