dsa · medium

Longest Palindromic Substring

Return the longest palindromic **substring** of s. If several have the same length, return any one of them.

Arguments

Example

"babad""bab" (or "aba").

"cbbd""bb".

Constraints

1 <= s.length <= 1000 s consists of digits and English letters Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.

Examples

Example 1

Input:
"babad"

Expected:
bab

Example 2

Input:
"cbbd"

Expected:
bb

Open in the Dojo editor