MEDIUMasked at 18 companies

Palindromic Substrings

A medium-tier problem at 72% community acceptance, tagged with Two Pointers, String, Dynamic Programming. Reported in interviews at Millennium and 17 others.

Founder's read

Palindromic Substrings is a medium-difficulty string problem that appears in live assessments at Millennium, Citadel, Salesforce, LinkedIn, and 14 other companies. It's the kind of problem that looks simple until you realize the brute force approach times out, or you waste 10 minutes implementing DP when there's a cleaner path. With a 71.7% acceptance rate, most candidates who see it pass, but the ones who blank on the expand-around-center trick tend to panic. If this problem hits your assessment and you freeze, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
18
Difficulty
MEDIUM
Acceptance
72%

Companies that ask "Palindromic Substrings"

If this hits your live OA

Palindromic Substrings is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by a senior engineer who knows the OA is theater. This is the script.

Get StealthCoder
What this means

The problem asks you to count all palindromic substrings in a given string. The trap is thinking you need a DP table or suffix array. The real trick is expand-around-center: for each possible center (both single characters and pairs of characters), expand outward while characters match and count valid palindromes. This runs in O(n^2) time with O(1) space, which beats the DP approach on both fronts. Most candidates either implement the DP solution correctly but inefficiently, or they attempt expand-around-center but miscalculate the number of centers or fail to handle odd vs. even palindrome lengths cleanly. Two Pointers, String, and Dynamic Programming all appear in the topic tags because all three approaches work, but only one feels elegant in an interview. StealthCoder is the hedge if you blank on the optimal pattern during your live assessment.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Palindromic Substrings recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by a senior engineer who knows the OA is theater. This is the script. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Palindromic Substrings interview FAQ

Is this really a medium problem?+

The 71.7% acceptance rate confirms it. Most candidates can code a working solution, but many waste time on DP or overcomplicate the logic. The expand-around-center trick is the insight that separates smooth interviews from ones that go sideways.

Do I need dynamic programming to solve it?+

No. DP works, but expand-around-center is simpler to code and more efficient in practice. Many candidates overthink it and fall into a DP trap, even though the problem tags DP as one of three valid approaches.

What's the trick I'm missing?+

You need to handle both odd-length and even-length palindromes. A single character is a palindrome, but so is 'aa'. Most candidates forget to loop through both center types, or they conflate the two cases and introduce off-by-one errors.

Why do Salesforce and LinkedIn ask this?+

It tests whether you can optimize past the naive approach, handle string traversal cleanly, and think about space-time tradeoffs. Companies like Salesforce and LinkedIn value candidates who code elegant solutions under pressure.

How much time should I spend on this in an interview?+

If you know the expand-around-center pattern, 15-20 minutes to code and test. If you're unsure, 25-35 minutes to work through DP or a less efficient approach. Either way, it's not a blocker problem. Blank on the pattern, StealthCoder solves it invisibly.

Want the actual problem statement? View "Palindromic Substrings" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.