Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
How many palindromic substrings (counted by position) does the string abbaabba contain?
- A. 17
- B. 16
- C. 18
- D. 20
Correct answer: B. 16
Expand around each of the 15 centres and count every palindrome found; the long palindromes such as abbaabba itself are included.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- How many distinct palindromic substrings does the string aabaa contain?
- What is the smallest integer x greater than 100 with x congruent to 3 modulo 7 and x congruent to 5 modulo 11?
- How many integers in [1, 200] are coprime to 210?
- What is the sum of all integers in [1, 50] that are either perfect squares or perfect cubes?
- What is the greatest common divisor of 6, 24, 60, 120 and 210?
- How many trailing zeros does 50! have when written in base 12 (note 12 = 2^2 3)?