since the lenth of the array is L, the first missing number must be less than or equal to L+1.

```
class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
l=len(nums)
if l==0: return 1
count=[0 for i in range(l+2)]
for i in range(len(nums)):
if 0<=nums[i]<l+1:
count[nums[i]]+=1
for i in range(1,l+2):
if count[i]==0:return i
return l+2
```