Find Smallest Positive Missing
Given a list of integers, find the smallest positive integer (greater than 0) that is not present in the list.
For example, if the list is [1, 3, 6, 4, 1, 2], the smallest positive missing integer is 5. If the list is [-1, -3], the smallest positive missing integer is 1. If the list is [1, 2, 3], the smallest positive missing integer is 4.
Input
The first line contains an integer N, the number of elements in the list. The second line contains N space-separated integers.
Output
Print a single integer: the smallest positive integer not present in the list.
Constraints
1 <= N <= 1000. The integers in the list are between -10^9 and 10^9.
Example 1
6 1 3 6 4 1 2
5
The positive numbers are 1, 3, 6, 4, 1, 2. The unique positives are 1, 2, 3, 4, 6. The smallest missing positive integer is 5.
Example 2
3 -1 -3 -5
1
There are no positive integers in the list. The smallest positive integer is 1.
Hints
# Read the input from stdin and print the answer.
import sys
def main():
data = sys.stdin.read().split()
# your code here
main()
6 1 3 6 4 1 2
3 -1 -3 -5