Data Structures & AlgorithmsVery hardICPC regional · CAT · MBA placement

Problem: The 10 numbers 1 to 10 are split into two groups of five. The sum of the group containing 10 is S. How many different values of S are possible?

  1. A. 21
  2. B. 126
  3. C. 26
  4. D. 20

Correct answer: A. 21

S = 10 + (sum of four of 1..9), which takes every value from 20 to 40: 21 values. 126 counts the splits, ignoring the 10 constraint gives 26, and 40 − 20 without + 1 gives 20.

More Coding Interview Problems questions

Exams that ask this topic