Skip to main content
mediumBlind 75

Palindromic Substrings

Given a string s, count the number of palindromic substrings in it A palindromic substring reads the same backward as forward Example: "abc" => 3 (a, b, c) Example: "aaa" => 6 (a, a, a, aa, aa, aaa)

I count expansions, not substrings. Push outward from each of the 2n-1 centers, and every step that still mirrors adds one.

StringTwo PointersDynamic Programming

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.

1Count Palindromic Substringsmedium
Based onLeetCode