Data Structures & AlgorithmsModerateTCS NQT · Infosys

Problem: In the string "abcbaxyzzyx", count the palindromic substrings of length exactly 5.

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

Correct answer: B. 1

Test each length-5 window against its reverse. Palindromes of other lengths, such as the length-3 'bcb', are excluded by the question.

More Coding Interview Problems questions

Exams that ask this topic