5. Longest Palindromic Substring
🟨 Medium
Question
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of sis 1000.
Example 1:
Example 2:
Approach: Expand Around Center
Time complexity: O(n^2)
Space complexity: O(1)
Manacher's Algorithm
Time complexity: O(n)
Space complexity: O(1)
Last updated
Was this helpful?