1539. Kth Missing Positive Number
class Solution:
def findKthPositive(self, arr: List[int], k: int) -> int:
l,r=0,len(arr)
while l<r:
mid=(l+r)//2
if arr[mid]-mid >k:r=mid
else:l=mid+1
return l+k
Just think about the examples.