Medium · Sorting

Minimum Deletions to Make Character Frequencies Unique

Given a string s of lowercase English letters, return the minimum number of characters to delete so that no two different letters remaining in s occur the same number of times.

Examples

Example 1

{
  "s": "aab"
}

Output: 0 deletions

Example 2

{
  "s": "aaabbbcc"
}

Output: 2 deletions

Rebuild it in the studio

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Sorting problems