#3158

Find the XOR of Numbers Which Appear Twice

easy · 78.8% accepted · 165 likes · top 90%

array · hash table · bit manipulation

⊣ practice⊣ open on leetcode ↗

Description

You are given an array nums, where each number in the array appears either once or twice.

Return the bitwise XOR of all the numbers that appear twice in the array, or 0 if no number appears twice.

Solution