Data Structures & AlgorithmsModerateCAT · TCS NQT

Problem: The string "BANANA" has how many distinct arrangements of its letters (letters are identical when they match)?

  1. A. 60
  2. B. 720
  3. C. 120
  4. D. 360

Correct answer: A. 60

BANANA has A × 3, N × 2, B × 1, so 6! / (3! · 2!) = 60. Ignoring repeats gives 720, dividing only by 3! gives 120, and dividing only by 2! gives 360.

More Coding Interview Problems questions

Exams that ask this topic