Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: Count the palindromic substrings of length exactly 4 in the string "aabbaabbaa".

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

Correct answer: C. 3

Test each length-4 window against its reverse. Including windows of other lengths, or counting only distinct strings, gives a different number.

More Coding Interview Problems questions

Exams that ask this topic