First Missing Positive
hard
1. Given an unsorted integer array 'arr'. 2. Find the smallest missing positive integer. Note : You must implement an algorithm that runs in O(n) time and uses constant extra space.
Constraints
1. 1 <= nums.length <= 10^5 2. -2^31 <= nums[i] <= 2^31 - 1
Format
Input
Input is managed for you.
Output
Output is managed for you.
Example
Sample Input
4
3 4 -1 1
Sample Output
2