Kth Missing Positive Number

Easy · Binary Search · about 15 minutes

Asked at Meta, Amazon, Google, Bloomberg, D. E. Shaw.

arr lists positive integers in strictly increasing order. Counting up 1, 2, 3, … and skipping every number that is in arr, which is the k-th number you reach? Can you beat O(n)?

Related guides