Data Structures & AlgorithmsModerateTCS NQT Digital · Infosys

Problem: How many distinct strings formed by permuting the letters of "aab" are palindromes?

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

Correct answer: A. 1

The distinct arrangements of 'aab' are aab, aba and baa; only 'aba' reads the same backwards. Counting raw permutations of the three positions (six) overstates the distinct strings.

More Coding Interview Problems questions

Exams that ask this topic