136. Single Number

Practice Single Number for free on NudgeCode: Easy, Bit Manipulation pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Every value in nums appears exactly twice except one, which appears once. Return that one. Aim for O(n) time and O(1) extra space.

Example

nums = [2,2,1]      ->  1
nums = [4,1,2,1,2]  ->  4

Constraints