Odd One Out
Every number in nums appears an even number of times, except for exactly one number, which appears an odd number of times. Return that number. The list is never empty. There is a one pass solution with no extra memory, because the XOR of two equal numbers is 0.
Example 1
nums [2,3,2]
returns 3
2 appears twice and 3 once, so 3 is the odd one out.
Example 2
nums [7]
returns 7
A single number appears once, which is an odd count.
Constraints
1 <= len(nums) <= 990 <= nums[i] <= 1000- exactly one value occurs an odd number of times
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.