```
class Solution(object):
def firstMissingPositive(self, nums):
nums = filter(lambda x: x > 0, nums)
for i in xrange(len(nums)):
j = abs(nums[i])-1
if j >= 0 and j < len(nums) and nums[j] > 0:
nums[j] = -nums[j]
for i in xrange(len(nums)):
if nums[i] > 0:
return i+1
return len(nums)+1
```