....我觉得是substring呢.... 原题需要添加的字符等于 S - the longest palindromic substring ending at S[end -1] To find the longest palindromic substring ending at S[end-1]: reverse S, using suffix tree to find the longest common substring (ending at S[end-1]) of S and S_r at O(n) time overall time complexity is O(n) edit: 我以为只能在后面加,原来是不限位置。
【在 r*********n 的大作中提到】 : ....我觉得是substring呢.... : 原题需要添加的字符等于 S - the longest palindromic substring ending at S[end : -1] : To find the longest palindromic substring ending at S[end-1]: : reverse S, using suffix tree to find the longest common substring (ending at : S[end-1]) of S and S_r at O(n) time : overall time complexity is O(n) : edit: : 我以为只能在后面加,原来是不限位置。
o*d
22 楼
end 这个不太对?考虑cbba 不能限制在ending在两端的
【在 r*********n 的大作中提到】 : ....我觉得是substring呢.... : 原题需要添加的字符等于 S - the longest palindromic substring ending at S[end : -1] : To find the longest palindromic substring ending at S[end-1]: : reverse S, using suffix tree to find the longest common substring (ending at : S[end-1]) of S and S_r at O(n) time : overall time complexity is O(n) : edit: : 我以为只能在后面加,原来是不限位置。
r*n
23 楼
结果是什么 cbbabbc the longest palindromic substring ending at S[end-1] is S[end-1] itself, which is a hence we should pad bbc (from cbb before a) after a 又看了下原题,我理解错题了,我以为只能在后面加
【在 o****d 的大作中提到】 : : end : 这个不太对?考虑cbba 不能限制在ending在两端的