题解 | #最长回文子串#
最长回文子串
http://www.nowcoder.com/practice/b4525d1d84934cf280439aeecc36f4af
# -*- coding:utf-8 -*-
class Solution:
def getLongestPalindrome(self, A, n):
# write code here
count= []
flag = 1
for i in range(1, n+1):
for j in range(0, n-i+1):
if A[j:i+j] == A[j:i+j][::-1]:
flag = i
else:continue
count.append(flag)
return max(count)
