```
A = nums
n = len(A)
i = 0
while i<n:
cp = A[i] -1
if 1 <= A[i] <= n:
if A[i] != A[cp]:
A[i], A[cp] = A[cp], A[i]
i = i - 1
i = i+1
for j in range(n):
if j+1 != A[j]:
return(j+1)
return(n+1)
```

This is my code in python 3. why it is showing TLE