[Question] Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.
Leetcode 给的答案:https://leetcode.com/articles/longest-palindromic-substring/
一开始用的brute force算了一下大概是O(n^3)果然不行,后来试着用中心展开O(n^2)就果断成功了。
答案里面其他两个思路 一个dp的应用,需要学习一下。然后另外一个叫Manacher’s algorithm的也要认真研究研究!