Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

How many ordered triples of positive integers (x, y, z) satisfy x + y + z = 10?

  1. A. 37
  2. B. 36
  3. C. 66
  4. D. 45

Correct answer: B. 36

Stars and bars with positive parts gives C(9, 2) = 36. Allowing zeros (the second option) gives C(12, 2) = 66, a common mistake.

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

Exams that ask this topic