Data Structures & AlgorithmsModerateICPC regional · Amazon SDE OA

How many palindromic substrings of length at least 2 occur in "aaa" (counted by position)?

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

Correct answer: C. 3

Every substring of 'aaa' is a palindrome. The length-2 substrings are two and the length-3 substring is one, which gives three.

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

Exams that ask this topic