Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA

What is the minimum number of elements that must be deleted from [4, 4, 1, 1, 1, 2, 3, 3] so the remaining values are pairwise distinct?

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

Correct answer: C. 4

Each value must keep at most one copy, so deletions equal the number of extra copies, n minus the count of distinct values.

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

Exams that ask this topic