题解 | 最长回文子串
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param A string字符串 # @return int整型 # class Solution: def getLongestPalindrome(self , A: str) -> int: # write code here L = len(A) B = "" for i in range(L): B = A[i] + B for i in range(L): k = L - i for j in range(i+1): if A[j: j+k] == B[L-j-k:L-j]: return k