You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We define an array or hash table `cnt` to record the occurrence of each number.
76
+
77
+
Next, we traverse the array `nums`. When a number appears twice, we perform an XOR operation with the answer.
78
+
79
+
Finally, we return the answer.
80
+
81
+
The time complexity is $O(n)$, and the space complexity is $O(M)$. Where $n$ is the length of the array `nums`, and $M$ is the maximum value in the array `nums` or the number of distinct numbers in the array `nums`.
0 commit comments