jeudi 15 août 2019

return count of scatter palindrome of a string

we have to find scatter palindrome strings inside given string and return number of scatter palindrome in string.For example given string aabb, the scatter palindromes are a, aa, aab, aabb , a, abb, b, bb, b. Here there are 9 substring that are scatter palindrome.

i have thought of brute force approach i.e generating all substring and checking them , please help me with a better approach

Aucun commentaire:

Enregistrer un commentaire