public int firstMissingPositive1(int[] A) {
        int[] array = new int[A.length+1];
        for(int i = 0; i < A.length; i++){
            int index = A[i];
            if(index >=1 && index <= A.length){
                array[index] = 1;
            }
        }
        int i=1;
        for( i=1; i<= A.length;i++){
            if(array[i] == 0)
                break;
        }
        return i;

    }