Medium · Strings
Longest palindromic substring
Given an ASCII string s, return the longest substring of s that is a palindrome (reads the same forwards and backwards); if several substrings share the maximum length, any one of them is accepted.
Examples
Example 1
{
"s": "babad"
}Output: "bab" (len 3)
Example 2
{
"s": "cbbd"
}Output: "bb" (len 2)
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.