First Missing Positive
Given an unsorted integer array arg1, return the smallest positive integer that is not present in arg1.
You must implement an algorithm that runs in O(n) time and uses O(1) auxiliary space.
The value zero and all negative numbers never count as candidates: only integers from 1 upward are considered, and duplicates do not matter because a value only has to be present once. If the array already contains every integer from 1 through n, the answer is n + 1, which means the result is always bounded by the length of the array plus one.
The intended solution runs in O(n) time and uses O(1) auxiliary space, so sorting the input or allocating a full hash set of the values is not allowed. Consider what information the array itself can carry once each candidate value is mapped onto a position.
First Missing Positive
Given an unsorted integer array `arg1`, return the smallest positive integer that is not present in `arg1`.