Given the string, I know how to find the number of palindrome substrings in linear time using the Manacher algorithm. But now I need to find the number of individual / unique palindrome substrings. Now this can lead to the O (n + n ^ 2) algorithm - one “n” for finding all such substrings, and n ^ 2 for comparing each of these substrings with those already found to check if it is unique.
I am sure there is an algorithm with better complexity. I was thinking about maybe trying my luck with suffix trees? Is there an algorithm with better time complexity?
source
share