Find Missing Number
Medium 
When given an list of numbers (whether sorted or unsorted) from 1 to n (ex. [1, 2, 3, 4]), find the missing number.
Examples:
Input: [1, 2, 3, 5] Output: 4
Input: [3, 2, 4, 1] Output: 5
Hint 1
What would the sum of all numbers in the list be if there were no numbers missing?
Hint 2
What would the sum of all the numbers in the list be if there was a number missing?
Hint 3
The sum of numbers 1..n is (n(n+1))/2
Test Cases
You haven't run your program yet.
×
Exercise Submitted!
Find Missing Number