Single Number

Given a non-empty integer array nums in which every element appears exactly twice except for one element that appears once, return that single element.

Given a non-empty integer array `nums` in which every element appears exactly twice except for one element that appears once, return that single element.

- `1 <= nums.length <= 3 * 10^4` - `-10^9 <= nums[i] <= 10^9` - Exactly one value appears once; every other value appears twice. - The interactive visualizer accepts at most 19 values; longer valid inputs are execution-only.

Example 1: input nums = [2,2,1]; output 1. 1 is the only unpaired value.

Example 2: input nums = [4,1,2,1,2]; output 4. 1 and 2 form pairs, leaving 4.

Category: Bit Manipulation. Topic: arrays. Difficulty: Easy. Patterns: bit-manipulation.