Data Structures & AlgorithmsHardGATE CS · CAT · MBA placement

In how many ways can the integer 10 be written as a sum of AT MOST 3 positive integers, where order does not matter (for example 10 = 7 + 2 + 1 = 2 + 7 + 1 is one way)?

  1. A. 14
  2. B. 8
  3. C. 6
  4. D. 23

Correct answer: A. 14

By conjugation (swap rows and columns of the Young diagram), partitions into at most 3 parts equal partitions into parts of size at most 3, counted by p(n, k) = p(n, k−1) + p(n−k, k). Counting exactly 3 parts, or allowing up to 4, gives a neighbouring count.

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

Exams that ask this topic