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

Starting Python
No results yet.

          
↑↓ move ↵ open esc close

Labs

Loading labs…

Run with your own input

Starting Python

Loading Python…