← All problems

Single Number

EasyBit Manipulation

Given a non-empty array where every element appears twice except one — find the one. O(n) time and O(1) space.

Examples

Input: nums = [2,2,1]
Output: 1
Input: nums = [4,1,2,1,2]
Output: 4

Hints

Solution

Language:
Loading editor…
Output0 lines
Run your code to see output here.
Click Run all tests to check your solution against 4 test cases.