#K7786. Missing Positive Integer
Missing Positive Integer
Missing Positive Integer
You are given an array of integers. Your task is to find the smallest positive integer (greater than 0) that is missing from the array.
The problem can be formally stated as: Given an array \(A\) containing \(n\) integers, find the smallest positive integer \(x\) such that \(x \notin A\). For example, if \(A = [1,2,3,4,5,6]\), then \(x = 7\); if \(A = [2,3,4,5]\), then \(x = 1\>.
Note that the input is provided in a single test instance via standard input (stdin) and the result should be printed to standard output (stdout).
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 array \(A\).
outputFormat
Output a single integer which is the smallest positive integer that is not present in the array.
In mathematical form, find the smallest positive integer \(x\) such that \(x \notin A\).
## sample6
1 2 3 4 5 6
7
</p>