You are given a sorted array nums
containing distinct integers. Your task is to find the k
-th missing number, counting from the first element of the array moving towards the right.
Example 1: Input: nums = [3,6,8,9], k = 2 Output: 5 Explanation: The missing numbers are [4,5,7,...]. The 2nd missing number is 5.
Example 2: Input: nums = [5,9,12,14], k = 4 Output: 10 Explanation: The missing numbers are [6,7,8,10,11,13,...]. The 4th missing number is 10.
Example 3: Input: nums = [2,3,7], k = 5 Output: 8 Explanation: The missing numbers are [4,5,6,8,9,...]. The 5th missing number is 8.
1 <= nums.length <= 60000
1 <= nums[i] <= 2 * 107
1 <= k <= 2 * 108