Medium
Count Palindromic Substrings
Medium
97 submissions
25 coins
+100 XP
Dynamic Programming
String
Problem Description
Return how many substrings of `s` are palindromes. Substrings at different positions count separately, even if they are equal.
**Example 1:**
```
Input: s = "abc"
Output: 3
```
**Example 2:**
```
Input: s = "aaa"
Output: 6
```
**Example 3:**
```
Input: s = "abba"
Output: 6
```
Constraints
- `1 <= s.length <= 1000`
- Lowercase English letters only.
Need help?
Connect with expert programmers for real-time collaborative coding, video meetings, and whiteboard sessions via CodeConnect.
Video Call
Whiteboard
Live Coding
Screen Share