This question evaluates proficiency in string manipulation and algorithmic problem-solving, focusing on palindrome detection and substring handling within the Coding & Algorithms domain.
Given a string s, return the longest contiguous substring of s that is a palindrome (reads the same forward and backward).
s
: a non-empty string of length
n
s
that is the longest palindrome. If multiple answers exist, return any one.
1 ≤ n ≤ 2000
s
contains ASCII letters/digits (you may assume no spaces).
"babad"
→ Output:
"bab"
(or
"aba"
)
"cbbd"
→ Output:
"bb"