Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA

What is the minimum number of elements to delete from [4, 7, 2, 9, 5] so that the remaining sum is divisible by 3? (The empty remainder is allowed.)

  1. A. 1
  2. B. 2
  3. C. 0
  4. D. 3

Correct answer: C. 0

The total is 27, already divisible by 3, so no deletions are needed. Deleting elements just to change the residue would only add cost.

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

Exams that ask this topic