Day 8The Missing Number
Easylistsmath
A list contains every whole number from 0 to n except one, in any order. Write missing_number(nums) that returns the missing number.
For [3, 0, 1], n is 3 and the missing number is 2.
Examples
Example 1
>>> missing_number([3, 0, 1]) 2
Example 2
>>> missing_number([0, 1]) 2
Good to know
- The list has
nnumbers, sonislen(nums). The missing one can be 0 ornitself.
Run examples checks the 2 examples above. Submit runs all 6 tests, including hidden edge cases, and marks the challenge solved.