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
Core interview problems are free with a full runner and lessons; Pro opens the complete library.