Single Number

Easy · Bit Manipulation · Array · Bit Manipulation

Problem

Every element in nums appears twice except for one, which appears once. Return that one.

Solve it in linear time using constant extra space.

Examples

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

Constraints

Approaches

Related problems

Start free on Cariara · Coding problems · System design studio

Coding practice is in SolveMe.Open