Missing Number
InterviewTime limit1sMemory limit512 MB
A string lists the numbers 1 to n in order with one number erased; find the missing value.
- Level
Easy2 of 10
- Topics
- String, Implementation, Brute force
- Solved
- No attempts yet
Problem
You are teaching kindergarten! You wrote down the numbers from to , in order, on a whiteboard. While you were not paying attention, one of your students erased one of the numbers.
Can you tell which number your mischievous student erased?
Input
The first line of input contains a single integer (), which is the number of numbers that you wrote down.
The second line of input contains a string of digits, which represents the numbers you wrote down (minus the one that has been erased). There are no spaces in this string. It is guaranteed to contain all of the numbers from to , in order, except for the single number that the student erased.
Output
Output a single integer, which is the number that the tricky student erased.