Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Missing Number
Bookmark
Input
Example 1
Example 2
Example 3
Custom
nums
=
[3, 0, 1]
0
1
2
3
0
1
expected values 0..3
0
1
2
3
algo
master
.
io
Step:
nums holds 3 distinct numbers from 0..3, so exactly one is missing. XOR indices and values: everything pairs up except the missing number
0 / 5
Input
Example 1
Example 2
Example 3
Custom
nums
=
[3, 0, 1]
0 / 5
0
1
2
3
0
1
expected values 0..3
0
1
2
3
algo
master
.
io
Step:
nums holds 3 distinct numbers from 0..3, so exactly one is missing. XOR indices and values: everything pairs up except the missing number