Minimum Deletions to Make Character Frequencies Unique
A string s is good when no two different characters in s have the same frequency (the number of times the character appears). Given s, return the minimum number of characters you must delete to make s good. A character whose frequency drops to 0 no longer counts.
30:00
Minimum Deletions to Make Character Frequencies Unique
A string s is good when no two different characters in s have the same frequency (the number of times the character appears). Given s, return the minimum number of characters you must delete to make s good. A character whose frequency drops to 0 no longer counts.
Example 1:
Input: {"s":"aab"}
Output: 0
Constraints:
1≤s.length≤105
s contains only lowercase English letters.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"s":"aab"}
Count each letter of "aab". Two letters may not share a count, so some bars have to be cut down.