Missing Number
Easy 20 XPArraysMath
Commonly asked at Amazon, Microsoft, Apple
A list contains n distinct numbers taken from 0, 1, 2, …, n. Exactly one number in that range is missing. Print it.
- Input
- One line of space-separated integers.
- Output
- The missing number.
Sample 1
Input
3 0 1
Output
2
Read input with input() (no prompt message) and print only the answer. Run tries the Input box; Submit checks all test cases.
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.The solution unlocks after 3 submissions.