Data Structures & AlgorithmsHardICPC regional · CAT

Problem: How many 4-element subsets of {1, 2, ..., 8} have a sum that is a multiple of 5?

  1. A. 52
  2. B. 14
  3. C. 7
  4. D. 11

Correct answer: B. 14

Enumerating the 70 four-subsets of 1..8 finds 14 with sum ≡ 0 (mod 5). All subset sizes give 52, sum exactly 20 gives 7, and 3-subsets give 11.

More Coding Interview Problems questions

Exams that ask this topic