Intermediate
Open
Pro
Longest Palindrome in a String
Given a string s, return the longest substring of s that is a
palindrome (reads the same forwards and backwards). If there are
multiple longest palindromic substrings, return any one of them.
Example 1
Input: s = "babad"
Output: "bab"
Explanation: "aba" is also a valid answer.
Example 2
Input: s = "cbbd"
Output: "bb"
Constraints
1 <= s.length <= 1000sconsists only of digits and English letters.
Share this question