Learn
Practice
Newsletter
Resources
F
Toggle theme
0
F
Toggle theme
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
XOR all indices (1..n) and elements to find missing number
algo
master
.
io
Step:
Find the missing number using XOR. XOR of a number with itself is 0, and XOR with 0 is the number itself.
0 / 5
Input
Example 1
Example 2
Example 3
Custom
nums
=
[3, 0, 1]
0 / 5
0
1
2
3
0
1
XOR all indices (1..n) and elements to find missing number
algo
master
.
io
Step:
Find the missing number using XOR. XOR of a number with itself is 0, and XOR with 0 is the number itself.