Given a string, delete minimum characters so that no two different characters have the same frequency. For , frequencies are , . Already unique, answer is . For , frequencies are , , . Delete one or to make them different. Answer is . Constraint: you can only delete characters, not add them. Deleting reduces a character's frequency. The goal is to make all non-zero frequencies distinct.
If two characters have the same frequency, you must reduce one of them until it differs or reaches zero.