#136

Single Number

newbie · 200 · lc easy +16 · 77.4% accepted · 18,713 likes · top 89%

play →

Description

You are given a non-empty integer array nums where every element appears exactly twice except for one element which appears only once.

Find and return that unique element.

Your solution must run in linear time using only constant extra space.

Code

1
2
3