Data Structures & AlgorithmsHard

How many subsequences of EXACTLY three elements of 1 2 3 4 5 6 7 8 (chosen by position) have an EVEN sum?

  1. A. 12
  2. B. 56
  3. C. 29
  4. D. 28

Correct answer: D. 28

A sum is even exactly when the number of odd picks is even, so classify the four odd and four even values and combine the two parity classes. Using the odd-sum count, pairs instead of triples, or doubling each mistake the parity counts.

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

Exams that ask this topic