经典马拉车算法,马拉车算法的原理就是利用回文串的镜像对称省去了不必要的比较 class Solution { public: int getLongestPalindrome(string A, int n) { // write code here int len = 2 * n + 1; string b(len,'#'); if (n < 2) { return n; } for (int i = 0; i < n; i++) { ...