Dashboard
LC #647

Palindromic Substrings

Pattern · ?MetaMicrosoftAmazonGoogle

Problem

Count how many substrings of s are palindromes.

Constraints

  • 1 ≤ s.length ≤ 1000
  • s consists of lowercase English letters

Example

Input
s = "abc"
Output
3
Why
"a", "b", "c" are each palindromes. Total = 3.

Spot the pattern

Which pattern cracks it?

Hints

One at a time
Solve on LeetCode ↗