-
Notifications
You must be signed in to change notification settings - Fork 0
LC 1539 [E] Kth Missing Positive Number
Code with Senpai edited this page Oct 10, 2022
·
5 revisions
class Solution:
def findKthPositive(self, A: List[int], k: int) -> int:
n = len(A)
l = 0
r = n
while l < r:
m = (l + r) // 2
numMissPos = A[m] - m - 1
if numMissPos < k:
l = m + 1
else:
r = m
return l + k
footer