Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA

Remove exactly two elements from [4, 1, 5, 2, 3] to maximise the sum of what remains. What is the maximum remaining sum?

  1. A. 13
  2. B. 11
  3. C. 12
  4. D. 15

Correct answer: C. 12

The best choice removes the two smallest values, 1 and 2, leaving 4 + 5 + 3 = 12. Removing the largest values is the opposite choice.

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

Exams that ask this topic