nums contains n distinct numbers taken from the range [0, n]. Return the only number in that range that is missing.
nums
n
[0, n]
nums = [3,0,1]
2
Why
The range is 0…3 and 2 is missing.
nums = [0,1]
n == nums.length 1 <= n <= 10^4 All numbers are unique.
Topics
Implement missingNumber in the editor and return the answer — printing it is never graded.
missingNumber
Problem 38 of 1146 in the arena