Missing Element in Sorted Array
Problem statement
nums is strictly increasing. Starting after nums[0], consider positive integer values absent from the array in ascending order. Return the k-th missing value.
Function
missingElement(nums: int[], k: int) → intExamples
Example 1
nums = [4,7,9,10]k = 3return = 8The missing values are 5, 6, and 8.
Constraints
1 <= nums.length <= 5 * 10^4.1 <= k <= 10^9.- The answer fits in signed 32-bit range.