Search
⌘K

Leetcode 1481. Least Number of Unique Integers after K Removals

Remove exactly k elements from an integer array to minimize the number of distinct values remaining. This reduces to counting element frequencies and greedily eliminating values with the smallest counts until k is used.

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early January, 2025

Google

Google

Mid-level

Given a fixed size array of integers and a storage limit S, find a number x to truncate each array integer to the largest optimal number such that the sum of the array after truncations is S

Comments

Your account is free and you can post anonymously if you choose.