Data Structures & AlgorithmsHardGATE CS · CAT · MBA placement

How many DIFFERENT values can the sum of three distinct integers chosen from 1 to 9 take?

  1. A. 19
  2. B. 84
  3. C. 21
  4. D. 18

Correct answer: A. 19

Every sum between the minimum 1 + 2 + 3 = 6 and the maximum 7 + 8 + 9 = 24 is achievable with distinct triples, so the count is the number of integers in that range. Counting the triples (C(9, 3) = 84) counts repeated sums many times.

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

Exams that ask this topic