#K1001. Find the Smallest Missing Positive Integer
Find the Smallest Missing Positive Integer
Find the Smallest Missing Positive Integer
You are given an unsorted list of integers. Your task is to find the smallest positive integer that is not present in the list.
In mathematical notation, for a given set \( A \) of integers, you are to find the minimum positive integer \( k \) such that \( k \notin A \). That is, find \[ k = \min\{ k \in \mathbb{N} : k \notin A\}. \]
Note that the list may contain negative numbers and duplicates.
inputFormat
The first line of input contains a single integer \( n \) representing the number of elements in the list. The second line contains \( n \) space-separated integers.
Example:
6 3 4 -1 1 2 6
outputFormat
Output a single integer, which is the smallest missing positive integer from the list.
For the example above, the output should be:
5## sample
6
3 4 -1 1 2 6
5
</p>