Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional

How many index pairs i < j in [2, 3, 4, 5, 8, 9] have an odd sum?

  1. A. 9
  2. B. 15
  3. C. 6
  4. D. 3

Correct answer: A. 9

An odd sum needs one even (2, 4, 8) and one odd (3, 5, 9) element: 3 × 3 = 9 pairs. 15 counts all pairs, 6 counts the even-sum pairs, and 3 is the size of one group.

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

Exams that ask this topic