Data Structures & AlgorithmsVery hardCodeforces Div2 C · TCS NQT

What is the minimum number of characters you must DELETE from "aabbbccddddeee" so that every letter that remains appears the same number of times?

  1. A. 4
  2. B. 6
  3. C. 9
  4. D. 5

Correct answer: A. 4

Try every common target frequency t: letters with count at least t are reduced to t, and letters with count below t must be removed entirely. Take the minimum deletions over all t. Reducing every letter to the smallest count is a common wrong target.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic