Easy
,Array
,Binary Search
1539. 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:
Example 2:
Constraints:
arr.length
<= 1000arr[i]
<= 1000k
<= 1000arr[i]
< arr[j]
for 1 <= i
< j
<= arr.length
Follow up:
Could you solve this problem in less than O(n) complexity?
Ron ChenMon, Mar 6, 2023
學習了,本來還暴力解,不過也是會過ㄎㄎ
MarsgoatMon, Mar 6, 2023