Skip to content

Practice Least Number of Unique Integers after K Removals

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#1481
LeetCode Problem

Least Number of Unique Integers after K Removals

Problem Statement

Given an array of integers arr and an integer k. Find the least number of unique integers after removing exactly k elements.

Source: Least Number of Unique Integers after K Removals on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
arr = [5,5,4], k = 1
Output
1

# Example 2

Input
arr = [4,3,1,1,3,3,2], k = 3
Output
2

Constraints

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

Related LeetCode Problems

Practice more problems similar to Least Number of Unique Integers after K Removals.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.