Back to course home
0% completed
Solution: Count of Palindromic Substrings
Problem Statement
Given a string, find the total number of palindromic substrings in it. Please note we need to find the total number of substrings and not subsequences.
Example 1:
Input: "abdbca"
Output: 7
Explanation: Here are the palindromic substrings, "a", "b", "d", "b", "c", "a", "bdb".
Example 2:
Input: = "cddpd"
Output: 7
Explanation: Here are the palindromic substrings, "c", "d", "d", "p", "d", "dd", "dpd".
Example 3:
Input: = "pqr"
Output: 3
Explanation: Here are the palindromic substrings,"p", "q", "r".
Constraints:
- `1 <= st
.....
.....
.....
Like the course? Get enrolled and start learning!