Find the -th positive integer that does not appear in a strictly increasing sorted array.
You are given a strictly increasing array of positive integers. Some positive integers are missing from the array.
Return the -th positive integer that does not appear in the array when counting missing positive numbers in increasing order starting from $1$.
The array is already sorted and contains no duplicates, so you should use that structure to find the answer efficiently.
arr of strictly increasing positive integers.k representing which missing positive number to return.Return the -th missing positive integer.
1 <= arr.length1 <= arr[i]arr is strictly increasing1 <= kExample 1
Input
arr = [2,3,4,7,11], k = 5
Output
9
Explanation
The missing positive numbers are 1, 5, 6, 8, 9, 10, ... The 5th missing number is 9.
Example 2
Input
arr = [1,2,3,4], k = 2
Output
6
Explanation
The missing positive numbers are 5, 6, 7, ... The 2nd missing number is 6.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.