Palindromic Tree Census Problem
Palindromic Tree Census Problem — ExecCode Hard DSA Practice
Solve the Palindromic Tree Census problem on ExecCode. Free online hard DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Count distinct palindromic substrings of s (different strings, not different positions). A palindromic tree (eertree) creates one node per distinct palindrome in linear time. Substring a and aa are different. Return how many distinct palindromic substrings exist. You are given: s — text Return count of distinct palindromes. Positions do not matter: aba in two places still counts once.
Examples
Input {'s': 'aaa'}; Output 3. Input {'s': 'abc'}; Output 3. Input {'s': 'aba'}; Output 3
Constraints
Single letters are palindromes Empty string 0
Practice Palindromic Tree Census free on ExecCode. Browse DSA problems, topic map, and placement guides.