Given an unsorted integer array nums, return the smallest positive integer that does not appear in it.
nums
Your algorithm must run in O(n) time and use O(1) extra space.
nums = [1,2,0]
3
nums = [3,4,-1,1]
2
1 <= nums.length <= 10^5 -2^31 <= nums[i] <= 2^31 - 1
Topics
Implement firstMissingPositive in the editor and return the answer — printing it is never graded.
firstMissingPositive
Problem 102 of 1146 in the arena