#C11874. Smallest Missing Positive
Smallest Missing Positive
Smallest Missing Positive
Given an array of integers, your task is to find the smallest missing positive integer. Negative numbers and zero are ignored when searching for the answer.
For example, in the array [1, 2, 0] the smallest missing positive integer is 3, while in the array [3, 4, -1, 1] the answer is 2.
You can express the requirement mathematically as: \(f(S) = \min\{ x \in \mathbb{N}^{+} : x \notin S \}\), where \(S\) is the set of positive integers in the array.
inputFormat
The first line contains an integer \(T\) indicating the number of test cases. Each of the following \(T\) lines contains a sequence of space-separated integers representing an array.
Constraints: \(1 \le T \le 100\) and each array contains between 1 and 100 integers.
outputFormat
For each test case, output a single line containing the smallest missing positive integer.
## sample3
1 2 0
3 4 -1 1
7 8 9 11 12
3
2
1
</p>