Data Structures & AlgorithmsHardCodeforces Div2 C · TCS NQT

How many substrings of "abacaxayaba" are palindromes of ODD length at least 3?

  1. A. 7
  2. B. 5
  3. C. 4
  4. D. 16

Correct answer: B. 5

Expand around each centre and count only the odd-length palindromes of length 3 or more. The last option counts all palindromic substrings including the single letters and even-length ones, which is a different count.

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

Exams that ask this topic