package leetcode;

/**
 * https://leetcode.com/problems/kth-missing-positive-number/
 */
public class Problem1539 {
    public int findKthPositive(int[] arr, int k) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1539 prob = new Problem1539();
        System.out.println(prob.findKthPositive(new int[]{2,3,4,7,11}, 5)); // 9
        System.out.println(prob.findKthPositive(new int[]{1,2,3,4}, 2)); // 6
    }
}

@@ -172,38 +172,65 @@
     
-// TODO%0A        return
+int count = 0;%0A        int i = 1;%0A        int j =
  0;%0A    
 %7D%0A%0A 
@@ -229,260 +229,265 @@
     
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1539 prob = new Problem1539();%0A        System.out.println(prob.findKthPositive(new int%5B%5D%7B2,3,4,7,11%7D, 5)); // 9%0A        System.out.println(prob.findKthPositive(new int%5B%5D%7B1,2,3,4%7D, 2)); // 6
+while (true) %7B%0A            if (j %3C arr.length && arr%5Bj%5D == i) %7B%0A                j++;%0A            %7D else %7B%0A                count++;%0A                if (count == k) %7B%0A                    return i;%0A                %7D%0A            %7D%0A            i++;%0A        %7D
 %0A   

Solve problem 1539