Hard · Tries
Find Distinct Palindromic Substrings
Given a string s of lowercase letters, return the number of distinct non-empty substrings of s that are palindromes; each different string counts once, however often it occurs.
Examples
Example 1
s = "aba"Output: 3 distinct palindromes
Example 2
s = "aabb"Output: 4 distinct palindromes
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.