suffix tree O(n), construct new string S~S^, where ~ is a character not in S, and S^ is the reverse of S. then consider odd and even substring separately, very similar. for substring center at j, where 0<=jcan tell you LCP of two string in O(1), so complexity to find maximum palindrome is O(n). I think straight forward approach or DP or KMP is more reasonable solution for this problem during the interview.
in O(n)
【在 g******0 的大作中提到】 : how to find the maximum palindrome in a string using suffix tree in O(n) : time? : xie xie!
【在 F**r 的大作中提到】 : suffix tree O(n), construct new string S~S^, where ~ is a character : not in S, and S^ is the reverse of S. then consider odd and even : substring separately, very similar. : for substring center at j, where 0<=j: can tell you LCP of two string in O(1), so complexity to find : maximum palindrome is O(n). : I think straight forward approach or DP or KMP is more reasonable : solution for this problem during the interview. : : in O(n)