Back to problems

K-th missing number

Algorithm · Point72 · Medium

You receive an unsorted array nums whose elements are unique positive integers, and an integer k. A positive integer is called missing when it does not occur anywhere in nums. Consider all missing positive integers sorted increasingly; return the value at the k-th position in that sorted list. k may exceed the number of elements in nums, and the array can have arbitrary gaps. The answer is guaranteed to be a positive integer within the allowed numeric bounds. Example 1:…

Checking your access…