public int firstMissingPositive(int[] A) {
	        int len = A.length;
	        if(len == 1 && A[0] != 1) return 1;
	        
	        int i = 0;
	        while (i<len){
	        	if(A[i] != (i+1) && A[i] >= 1 && A[i] <= len && A[A[i]-1] != A[i]){
	        		int temp = A[i];
	        		int index = A[i]-1;
	        		A[i] = A[A[i]-1];
	        		A[index] = temp;
	        	} else {
	        		i++;
	        	}
	        }
	        
	        for(int j = 0; j< len;j++){
	        	if(A[j]!=j+1)
	        		return j+1;
	        }
	        return len+1;
	    }