Logo
Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Palindromic Substrings (Medium)

Problem Statement

Given a string, determine the number of palindromic substrings present in it.

A palindromic substring is a sequence of characters that reads the same forwards and backward. The substring can be of any length, including 1.

Example

    • Input: "racecar"
    • Expected Output: 10
    • Justification: The palindromic substrings are "r", "a", "c", "e", "c", "a", "r", "cec", "aceca", "racecar".
    • Input: "noon"
    • Expected Output 6
    • Justification: The palindromic substrings are "n", "o", "o", "n", "oo", "noon".

.....

.....

.....

Like the course? Get enrolled and start learning!