320. Smallest Missing Positive
Print the smallest positive integer that does NOT appear in the array.
1 2 0 -> 3
3 4 -1 1 -> 2
7 8 9 -> 1
Positive means 1 or greater, so zero and negatives are simply irrelevant and the answer is never below 1.
Put everything in a set and try 1, 2, 3 upwards until one is missing. That
terminates quickly: with n values present, the answer can never exceed
n + 1, so at most n + 1 lookups happen however large the values are.
Constraints - `1 ≤ n ≤ 200000` - `-1000000000 ≤ a[i] ≤ 1000000000`
Input
The first line contains an integer n.
The second line contains n integers.
Output
Print one integer, the smallest positive integer absent from the array.