Why this is giving TLE , I think it is O(n) and O(1) (python 3)


#1

Please anyone can explain me

maxi=max(A)

    for i in range(1,maxi+2):
        if(i not in A and i>0):
            return(i)
            
    else:
        return(1)

#2

I got it , my code has complexity of O(max(A)) not O(len(A))