@@ -0,0 +1,1334 @@
+class Solution %7B%0A    public int findKthPositive(int%5B%5D a, int k) %0A    %7B%0A        int B%5B%5D = new int%5Ba.length%5D;%0A        %0A        //equation (A)%0A        //B%5Bi%5D=a%5Bi%5D-i-1%0A        %0A        %0A        //B%5Bi%5D=number of missing numbers BEFORE a%5Bi%5D%0A        for(int i=0;i%3Ca.length;i++)%0A            B%5Bi%5D=a%5Bi%5D-i-1; //-1 is done as here missing numbers start from 1 and not 0%0A        %0A        //binary search upper bound of k%0A        //smallest value%3E=k%0A        %0A        int lo=0,hi=B.length-1;%0A        %0A        while(lo%3C=hi)%0A        %7B%0A            int mid = lo+(hi-lo)/2;%0A            %0A            if(B%5Bmid%5D%3E=k)%0A                hi=mid-1;%0A            else%0A                lo=mid+1;%0A        %7D%0A        %0A        //lo is the answer%0A        %0A        /*now the number to return is a%5Blo%5D-(B%5Blo%5D-k+1) (EQUATION B)%0A        //where (B%5Blo%5D-k+1) is the number of steps we need to go back %0A        //from lo to retrieve kth missing number, since we need to find %0A        //the kth missing number BEFORE a%5Blo%5D, we do +1 here as %0A        //a%5Blo%5D is not a missing number when B%5Blo%5D==k%0A        //putting lo in equation(A) above%0A        //B%5Bi%5D=a%5Bi%5D-i-1%0A        //B%5Blo%5D=a%5Blo%5D-lo-1%0A        and using this value of B%5Blo%5D in equation B%0A        //we return a%5Blo%5D-(a%5Blo%5D-lo-1-k+1)%0A        we get lo+k as ans%0A        so return it*/%0A        %0A        return lo+k;%0A        %0A    %7D%0A%7D%0A

Add 1533_Kth_Missing_Positive_Number.java (#48)