Last updated
Was this helpful?
Last updated
Was this helpful?
Given a string, your task is to count how many palindromic substrings in this string.
The substrings with different start indexes or end indexes are counted as different substrings even they consist of same characters.
Example 1:
Example 2:
Note:
The input string length won't exceed 1000.
这题跟5 Longest Palindromic substring的做法基本一样,还是用2维dp来check哪些substring是palindrome。这题更简单,不用算longest,直接数数目。