Palindromic Substrings
Medium · Dynamic Programming · about 15 minutes
Asked at Meta, Microsoft, Bloomberg, Amazon, Google, Goldman Sachs.
Count the substrings of s that read the same in both directions. Substrings starting or ending at different positions are counted separately, even when their text is identical.