```
int firstMissingPositive(int A[], int n) {
for (int i=0;i<n;i++)
(A[i]<=0)?(A[i]=n+1):(true);
for (int i=0;i<n;i++){
if(A[i]>n)
continue;
A[i]>0?(A[A[i]-1]>0?(A[A[i]-1] *= (-1)):(true)):(A[(-1*A[i])-1]>0?(A[(-1*A[i])-1] *= (-1)):(true));
}
for (int i=0;i<n;i++)
if(A[i]>0)
return i+1;
return n+1;
}
```

Last executed input: [1,4,2,0,3,4,2,4,2]