解法1,动态规划之带备忘(table)的自顶向下法,建立一个二维表table来记录A[i:j]是否是回文子串,若 table[i][j] == 1则A[1:j+1]为回文串。 # -*- coding:utf-8 -*- class Palindrome: def getLongestPalindrome(self, A, n): # write code here if n <= 1: return n table = [[-1 for _ in range(n)] for __ in range(n)]...