268. Missing Number

Practice Missing Number for free on NudgeCode: Easy, Bit Manipulation pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

nums holds n different numbers taken from the range 0 to n. Exactly one number in that range is missing; return it.

Example

nums = [3,0,1]              ->  2
nums = [9,6,4,2,3,5,7,0,1]  ->  8

Constraints