Data Structures & AlgorithmsHardGATE CS · TCS NQT

From [4, 9, 2, 7, 5, 1] you may pick any elements (each at most once). What is the minimum number of picks so that the picked sum is at least 20?

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

Correct answer: B. 3

Picking the largest values first is optimal: 9 + 7 + 5 = 21 reaches 20 with three picks, and two picks cannot reach 20.

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

Exams that ask this topic