public class Solution {
public int firstMissingPositive(int[] A) {
for(int i=0;i<A.length;i++){
while(A[i]-1>=0&&A[i]<=A.length&&A[A[i]-1]!=A[i]){
int t=A[i];
int temp=A[t-1];
A[t-1]=A[i];
A[i]=temp;
}
}
int i=0;
for(i=0;i<A.length;i++){
if(i+1!=A[i])break;
}
return i+1;
}
}