Python o(n) easy


#1

class Solution:
# @param A : list of integers
# @return an integer
def firstMissingPositive(self, A):
maxi = -1
for i in range(0,len(A)):
maxi = max(maxi,A[i])
B = [0]*maxi
for i in range(0,len(A)):
if(A[i]>0):
B[A[i]-1]=1
if(maxi<0):
return 1
for i in range(0,len(B)):
if(B[i]==0):
return i+1
return maxi+1