Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: Count the palindromic substrings of "abcbaabc" that start at index 0 (each prefix that is a palindrome counts once).

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

Correct answer: A. 2

Only prefixes of the string are tested, one per end index. Counting palindromes anywhere in the string answers a different question.

More Coding Interview Problems questions

Exams that ask this topic