Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Single Number
Bookmark
Input
Example 1
Example 2
Example 3
Example 4
Custom
nums
=
[2, 2, 1]
0
1
2
2
2
1
algo
master
.
io
Step:
Every number appears twice except one. XOR all numbers: pairs cancel to 0, leaving the single number
0 / 8
Input
Example 1
Example 2
Example 3
Example 4
Custom
nums
=
[2, 2, 1]
0 / 8
0
1
2
2
2
1
algo
master
.
io
Step:
Every number appears twice except one. XOR all numbers: pairs cancel to 0, leaving the single number