Dashboard
LC #5

Longest Palindromic Substring

Pattern · ?AmazonGoogleMicrosoftMetaBloomberg

Problem

Find the longest substring of s that is a palindrome.

Constraints

  • 1 ≤ s.length ≤ 1000
  • s consists of only digits and English letters

Example

Input
s = "babad"
Output
"bab"
Why
"bab" is a valid palindromic substring (so is "aba")

Spot the pattern

Which pattern cracks it?

Hints

One at a time
Solve on LeetCode ↗