Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

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

  1. A. 17
  2. B. 16
  3. C. 18
  4. D. 20

Correct answer: B. 16

Expand around each of the 15 centres and count every palindrome found; the long palindromes such as abbaabba itself are included.

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

Exams that ask this topic