# 1060. Missing Element in Sorted Array

<https://leetcode.com/problems/missing-element-in-sorted-array>

## Description

Given an integer array `nums` which is sorted in **ascending order** and all of its elements are **unique** and given also an integer `k`, return the `kth` missing number starting from the leftmost number of the array.

**Example 1:**

```
**Input:** nums = [4,7,9,10], k = 1
**Output:** 5
**Explanation:** The first missing number is 5.
```

**Example 2:**

```
**Input:** nums = [4,7,9,10], k = 3
**Output:** 8
**Explanation:** The missing numbers are [5,6,8,...], hence the third missing number is 8.
```

**Example 3:**

```
**Input:** nums = [1,2,4], k = 3
**Output:** 6
**Explanation:** The missing numbers are [3,5,6,7,...], hence the third missing number is 6.
```

**Constraints:**

* `1 <= nums.length <= 5 * 104`
* `1 <= nums[i] <= 107`
* `nums` is sorted in **ascending order,** and all the elements are **unique**.
* `1 <= k <= 108`

**Follow up:** Can you find a logarithmic time complexity (i.e., `O(log(n))`) solution?

## ac

```java
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jaywin.gitbook.io/leetcode/solutions/1060-missing-element-in-sorted-array.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
