The missing number
mediumLists20 XP
nums holds all the whole numbers from 0 to n except one, in any order (so it has n items). Return the missing number.
Examples
- Input: nums = [3, 0, 1]Output: 2
- Input: nums = [9, 6, 4, 2, 3, 5, 7, 0, 1]Output: 8
Examples use JSON: true/false/null are True/False/None in Python.