Data Structures & AlgorithmsHard

Remove the MINIMUM possible number of elements from 4 3 5 2 6 so that the remaining elements have a sum of at most 10. How many different subsets of positions can be removed to achieve exactly that minimum?

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

Correct answer: C. 2

Find the smallest removal size that works, then count the removal sets of that size whose remainder stays within the cap. Counting all removal sets of size one, or changing the cap, gives different numbers.

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

Exams that ask this topic