```
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
for i in range(0,n):
if nums[i] < 1:
nums[i] = n + 1
for i in range(0,n):
x = abs(nums[i])
if 0 < x <= n and nums[x - 1] > 0:
nums[x - 1] = -nums[x - 1]
for i in range(0,n):
if nums[i] > 0:
return i + 1
return n + 1
```