Kth Missing Positive Number
Given an array arr of positive integers sorted in a strictly increasing order, and an integer k, return the kth positive integer that is missing from this array.
Kth Missing Positive Number

Given an array arr of positive integers sorted in a strictly increasing order, and an integer k, return the kth positive integer that is missing from this array.

Example 1:
Input: {"arr":[2,3,4,7,11],"k":5}
Output: 9
Input
arr ={"arr":[2,3,4,7,11],"k":5}

Find 5th missing positive in sorted array

Left
Mid
Right
k = 5
Strictly Increasing Array
L

2

idx=0miss=1

3

idx=1miss=1

4

idx=2miss=1

7

idx=3miss=3
R

11

idx=4miss=6

Binary search range: [0, 4]

Expected: 1, 2, 3, 4, 5, ... | Given: [2, 3, 4, 7, 11] | Finding 5th missing
Variables
No variables to display
DepthFunction Call
Stack empty
0/7