By Long Luo

To solve this problem, there are serval solutions. However, the best method is using XOR.

we have this XOR cheatsheet:

According to the Zero law, all the numbers appears twice will be $0$, and the single one will remain.

So code as follow:

## Analysis

• Time Complexity: $O(n)$.
• Space Complexity: $O(1)$.

All suggestions are welcome.
If you have any query or suggestion please comment below.
Please upvote👍 if you like💗 it. Thank you:-)

Explore More Leetcode Solutions. 😉😃💗