1539. Kth Missing Positive Number
number
Given an array arr
of positive integers sorted in a strictly increasing order, and an integer k
.
Return the k
th
positive integer that is missing from this array.
Example 1:
Example 2:
Constraints:
1 <= arr.length <= 1000
1 <= arr[i] <= 1000
1 <= k <= 1000
arr[i] < arr[j]
for1 <= i < j <= arr.length
分析
直接遍历数组,一边计算当前缺失了几个数字,一边找。
Last updated
Was this helpful?