Single Number

Easy
Arrays Array Bit Manipulation

Given an array where every element appears twice except one, find that single element.

Constraints

1 ≤ nums.length ≤ 3 × 10^4

Examples

Example 1:
Input: 2 2 1
Output: 1
Example 2:
Input: 4 1 2 1 2
Output: 4

Hints

XOR all numbers. a^a=0, a^0=a.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.