medium
Longest Palindromic Substring
Given a string, return the longest contiguous substring that reads the same forwards and backwards.
Constraints
- 1 ≤ s.length ≤ 1000
- Digits and English letters
Examples
in: s = "babad"
out: "bab"
"aba" is also valid.
in: s = "cbbd"
out: "bb"
Code it yourself
Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?
Choose an approach to check your pattern recognition, or reveal the discussion when you need help.