679. Missing Number
0
Easy
Given an array nums containing n distinct numbers in the range [0, n], find and print the only number in the range that is missing from the array.
Input Format
The input consists of two lines. The first line contains an integer n. The second line contains n space-separated integers representing the elements of the nums array.
Output Format
Print the missing number.
Example
Input
5
0 3 5 4 1
Output
2
Constraints
n is equal to the length of nums array, where 1 <= n <= 10^4. Each element in nums is an integer between 0 and n, and all numbers in nums are unique.
Loading...
View Submissions
Console