Data Structures & AlgorithmsHard

How many subsequences of EXACTLY four elements of 1 2 3 4 5 6 7 (position subsets) sum to 16?

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

Correct answer: A. 5

Enumerate the four-element subsets and count those with the exact target sum. Off-by-one targets, triples, and at-least conditions each change the count.

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

Exams that ask this topic