Problems > Count Palindromic Substrings > Editorial

Count Palindromic Substrings — Solution & Editorial

Back to the Problem

The same center-expansion as the longest-palindrome problem, but add 1 for every successful expansion instead of tracking the maximum.

Complexity: O(|S|2)