Question
Given a string
s, return the number of palindromic substrings in it.
A string is a palindrome when it reads the same backward as forward.
A substring is a contiguous sequence of characters within the string.
Idea
- Using the idea from Leetcode - Longest Palindromic Substring, use a Sliding Window 2 pointer solution
- Basically the same question except here, for every slide of the window, we add the palindromic substring to our result and for every update of i, add s[i] to our result