Count Palindromic Substrings in a String

Asked at Goldman Sachs · Coding Questions · Difficulty: Medium · Last asked Oct 26, 2024

Given a string `s`, count how many of its substrings are palindromes. A substring is a contiguous run of characters; two substrings with the same content at different positions are counted separately.

Loading the problem…