# 1481. Least Number of Unique Integers after K Removals

## Medium

***

Given an array of integers `arr` and an integer `k`. Find the *least number of unique integers* after removing **exactly** `k` element&#x73;**.**

1.

&#x20;

**Example 1:**

<pre><code>Input: arr = [5,5,4], k = 1
<strong>Output: 
</strong>1
<strong>Explanation
</strong>: Remove the single 4, only 5 is left.
</code></pre>

**Example 2:**

<pre><code>Input: arr = [4,3,1,1,3,3,2], k = 3
<strong>Output: 
</strong>2
<strong>Explanation
</strong>: Remove 4, 2 and either one of the two 1s or three 3s. 1 and 3 will be left.
</code></pre>

&#x20;

**Constraints:**

* `1 <= arr.length <= 10^5`
* `1 <= arr[i] <= 10^9`
* `0 <= k <= arr.length`


---

# 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://chiragjain.gitbook.io/neetcode/1481-least-number-of-unique-integers-after-k-removals.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.
