Minimum Deletions to Make Character Frequencies Unique
MediumGreedy
Decode it first. Clues, constraints, pattern and plan before any code.A string is good if no two different letters in it appear the same number of times. Letters that appear zero times do not count. Return the minimum number of characters to delete from s to make it good.
s = "aab" → 0 (a: 2, b: 1)
s = "aaabbbcc" → 2 (delete two b's: a 3, b 1, c 2)
s = "ceabaacb" → 2Constraints
1 <= s.length <= 10^5scontains only lowercase English letters.