Palindrome Counter

Palindrome Counter is a coding interview problem from Goldman interviews. Given a lowercase string s (length 1–5000), determine the total number of palindromic substrings—strings that read the same forward and backward, including single characters. Implement countPalindromes(s) to return this integer. This interview question focuses on string processing and accurate substring counting, asking candidates to analyze all palindromic occurrences within the input.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: