Minimum Deletions to Make Character Frequencies Unique
Medium · Greedy · about 15 minutes
Asked at Microsoft, Amazon, Google, Meta.
A string is good if no two different characters have the same frequency. Given s, return the minimum number of characters to delete to make it good. (A character with frequency 0 is ignored.)