#C8663. Smallest Missing Positive Integer
Smallest Missing Positive Integer
Smallest Missing Positive Integer
Given an array (A) of (n) integers, your task is to find the smallest positive integer that is missing from the array.
For example, if the array is [1, 2, 0, -1, 5, 3], every positive integer up to 3 is present, but 4 is missing, so the correct answer is 4. The input is given via standard input and the output should be printed on standard output.
inputFormat
The first line contains a single integer (n), denoting the number of elements in the array. The second line contains (n) space-separated integers representing the elements of the array.
outputFormat
Output a single integer: the smallest positive integer that does not appear in the input array.## sample
6
1 2 0 -1 5 3
4