【leetcode-5】Longest palindromic substring 最长回文子串

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.

做这道题之前要先了解什么是回文子串。回文串通俗的解释是,分别从字符串两端开始遍历,得到的结果相同,如“abba”,从两端的遍历结果都是:“abba”。

下面是代码实现:

【leetcode-5】Longest palindromic substring 最长回文子串

【leetcode-5】Longest palindromic substring 最长回文子串