Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Least Number of Unique Integers after K Removals

XPChallenge Points: 20
levelLevel: Medium

You are given:
• an integer array arr,
• and an integer k.
Your task is to remove exactly k elements from the array such that the number of unique integers remaining is minimized.
Return the least number of unique integers after removing exactly k elements.

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

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result