Problem · String
Palindromic Substrings (LC 647 :)
Given a string s, return the number of palindromic substrings in it.
A string is a palindrome when it reads the same backward as forward.
A substring is a contiguous sequence of characters within the string.
Examples
01 · Example 1
s = "abc" return = 3
Three palindromic strings: "a", "b", "c".
02 · Example 2
s = "aaa" return = 6
Six palindromic strings: "a", "a", "a", "aa", "aa", "aaa".
Constraints
1 <= s.length <= 1000sconsists of lowercase English letters.
More Citadel problems
- Minimum Path Sum to Target in Binary TreePHONE SCREEN · Seen Apr 2026
- Social Media SuggestionsSeen May 2025
- Best Sum Downward Tree PathSeen May 2025
- Price CheckSeen Feb 2025
- Get Distinct Goodness ValuesSeen Jan 2025
- Get Min OperationsSeen Jan 2025
- Count Stable SegmentsSeen Jan 2025
- Find Consistent LogsSeen Oct 2024
public int countSubstrings(String s) {
// write your code here
}
s"abc"
expected3
sign in to submit