← All problems
Longest Palindromic Substring
Given a string s, return the longest palindromic substring it contains. A palindrome reads the same forward and backward. If several answers tie, any one is acceptable.
Complexity
Time O(n^2), Space O(1)
Common pitfalls
- Only checking odd-length centers
- O(n^3) checking every substring
Your solution
Log in to save your code and track progress.