Solution: Palindromic Substrings
Explore how to count the number of palindromic substrings in a given string by applying dynamic programming. Learn to build a lookup table to avoid redundant checks and optimize the solution from a naive cubic time approach to a quadratic one. Understand each step from base cases of single and two-letter palindromes to checking longer substrings. This lesson helps you implement an efficient algorithm and analyze its time and space tradeoffs.
Statement
Given a string, s, return the number of palindromic substrings contained in it. A substring is a contiguous sequence of characters in a string. A palindrome is a phrase, word, or sequence that reads the same forward and backward.
Constraints:
s.length...