Longest Palindromic Substring
Given a string s, return the longest palindromic substring in s.
A substring reads the same forwards and backwards. If several substrings tie for the longest, return any one of them — any valid longest palindrome is accepted, not one specific string.
Example cases
- two answersin s = "babad"out "bab""aba" is also accepted — both are length-3 palindromes.
- even lengthin s = "cbbd"out "bb"
- single charin s = "a"out "a"
Constraints
- 1 <= s.length <= 1000
- s consists of digits and English letters.
s =
"babad"