Search
⌘K

Leetcode 2107. Number of Unique Flavors After Sharing K Candies

Given an array of integers representing candy flavors and an integer K for how many candies are shared/removed, determine how many distinct flavors remain after removing K candies. The core challenge is frequency counting and using a greedy strategy (remove duplicate occurrences first) or sorting of frequencies to maximize the number of unique flavors left under the K removals.


Question Timeline

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

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