MEDIUMasked at 3 companies

Minimum Deletions to Make Character Frequencies Unique

A medium-tier problem at 61% community acceptance, tagged with Hash Table, String, Greedy. Reported in interviews at American Express and 2 others.

Founder's read

Minimum Deletions to Make Character Frequencies Unique is a medium-difficulty string problem that tests your ability to spot when a greedy approach solves a frequency problem. You're given a string and need to remove the minimum number of characters so that no two distinct characters have the same frequency. It's been asked at American Express, ConsultAdd, and SmartNews. The trap is thinking you need to explore all deletion combinations, when in reality a single greedy pass does the work. If this problem hits your live assessment and you blank on the pattern, StealthCoder surfaces the solution in seconds while you're screen-sharing.

Companies asking
3
Difficulty
MEDIUM
Acceptance
61%

Companies that ask "Minimum Deletions to Make Character Frequencies Unique"

If this hits your live OA

Minimum Deletions to Make Character Frequencies Unique is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage.

Get StealthCoder
What this means

The trick here is treating frequencies as a sortable asset. Count character frequencies, sort them in descending order, then iterate through and greedily reduce any frequency that conflicts with a previously seen frequency. Each time a conflict happens, decrement and try again until it's unique or drops to zero. The common miss is trying to optimize which character to delete from, or building a complex DP table. Neither works because this is pure greedy: once you have the frequency map, the order of deletion is deterministic. Hash Table handles the frequency count, Sorting orders them for the greedy pass, and the logic itself is deceptively simple. Most candidates struggle because they overthink the deletion strategy instead of realizing the frequency values themselves carry all the information you need.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Minimum Deletions to Make Character Frequencies Unique recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Minimum Deletions to Make Character Frequencies Unique interview FAQ

Is this problem really just a greedy sort or is there a harder version?+

It's pure greedy once you count frequencies. Sort descending, iterate once, and decrement on conflicts. The hard part is recognizing that pattern exists at all, not implementing it. Most OA candidates spend time coding a backtracking solution that times out.

How does this relate to other frequency-based problems?+

It combines Hash Table counting with Sorting and Greedy decision-making. Similar structure to problems asking for max frequency after operations, but simpler because you're only reducing, never redistributing across characters.

What's the edge case that kills most solutions?+

A character frequency dropping to zero during a greedy pass. You must allow frequencies to go to zero and stop counting them as 'in use' for conflict checks. Also watch strings where all characters already have unique frequencies; you delete zero.

Do American Express and SmartNews ask follow-ups on this problem?+

Input data doesn't specify follow-ups, but if one is asked, it's likely asking for the actual string after deletions, not just the count. That's a minor change: track which character each deleted occurrence came from.

How long should this take in a real OA if I know the pattern?+

Five to eight minutes to code and test once you recognize it's a frequency sort plus greedy pass. Miss the pattern and you're debugging a backtracking solution for forty minutes. That's where the real risk lives.

Want the actual problem statement? View "Minimum Deletions to Make Character Frequencies Unique" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.