Data Structures & AlgorithmsModerateCAT · TCS NQT

Problem: The number of ways to place 3 identical red balls and 2 identical blue balls in a row of 5 positions is what value?

  1. A. 120
  2. B. 10
  3. C. 20
  4. D. 32

Correct answer: B. 10

Choosing the 2 blue positions fixes the row: C(5,2) = 10. Treating all balls as distinct gives 5! = 120, ordered blue positions give 20, and 2⁵ = 32 allows any colour count.

More Coding Interview Problems questions

Exams that ask this topic