Data Structures & AlgorithmsModerateTCS NQT · Infosys

Problem: Can the array [1, 5, 11, 5] be split into two subsets with equal sums? Answer 1 for yes and 0 for no.

  1. A. 2
  2. B. 1
  3. C. 0
  4. D. 3

Correct answer: B. 1

The partition question reduces to whether some subset sums to half the total, which is 11 here. The subset {11} achieves it, so the answer is yes.

More Coding Interview Problems questions

Exams that ask this topic