Data Structures & AlgorithmsHard

How many subsequences of exactly three elements of 1 6 4 9 5 3 (position subsets) have a sum divisible by 5?

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

Correct answer: D. 5

Each triple's residue mod 5 is determined by its three values, and triples are enumerated exactly. Using residue 1, pairs, or quadruples counts different objects.

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

Exams that ask this topic