Longest Palindromic Substring
Given a string s, return the longest palindromic substring in s.
A substring is a contiguous sequence of characters within a string. A palindrome is a string that reads the same forward and backward.
If there are multiple valid longest palindromic substrings, you may return any one of them.
Example 1
Input
s = "babad"Output
"bab"The substring
bab reads the same forward and backward and has maximum length; aba is also a valid answer.Example 2
Input
s = "cbbd"Output
"bb"The longest palindromic substring is
bb.Constraints
- 1 <= s.length <= 1000
- s consists of only digits and English letters.