Data Structures & AlgorithmsHardGATE CS · TCS NQT

How many palindromic substrings does the string aabbaa contain (counted by position)?

  1. A. 13
  2. B. 11
  3. C. 9
  4. D. 15

Correct answer: B. 11

Single characters give 6; expand around centres for even and odd palindromes, such as aa, bb, aa, abba and aabbaa. Repeated letters at different positions count separately.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic