In a class, the students have roll numbers from 0 to n. The list nums holds the roll numbers of the n students who came today, all different. Exactly one roll number is absent.
Return the roll number that is missing from nums.
Examples
Example 1:
Input: nums = [1,2,0,4]
Output: 3
Explanation: Here n = 4, so the roll numbers are 0 to 4. Roll number 3 is absent.
Example 2:
Input: nums = [2,1,0]
Output: 3
Explanation: Here n = 3, so the roll numbers are 0 to 3. Roll number 3 is absent. The missing number can be n itself.
Example 3:
Input: nums = [4,0,3,1]
Output: 2
Explanation: Here n = 4. Roll number 2 is absent.