题解 | #最长回文子串#
最长回文子串
https://www.nowcoder.com/practice/b4525d1d84934cf280439aeecc36f4af
暴力解法
class Solution: def getLongestPalindrome(self, A: str) -> int: max_len = 1 for start_index in range(0,len(A)): end_index = start_index while end_index < len(A): group_now = A[start_index:end_index+1] if group_now == group_now[::-1]: max_len = max(max_len,len(group_now)) end_index +=1 return max_len