Data Structures & AlgorithmsModerateCAT · TCS NQT

Problem: In a list of 6 candidates, each candidate is either rejected or accepted. The number of ways to accept at least 2 and at most 4 candidates is what value?

  1. A. 20
  2. B. 50
  3. C. 57
  4. D. 64

Correct answer: B. 50

C(6,2) + C(6,3) + C(6,4) = 15 + 20 + 15 = 50. Exactly 3 gives 20, 'at least 2' with no upper limit gives 57, and 64 counts every subset.

More Coding Interview Problems questions

Exams that ask this topic