Quantcast
Channel: 《最长回文子串》的评论
Browsing latest articles
Browse All 10 View Live

作者:Elvin

楼主DP解法中程序会有数组越界错误。 比如字符串为aba, xlen=3,运行到 len=1, begin=2时,end=3,这时X[3]已经越界了。

View Article



Image may be NSFW.
Clik here to view.

作者:Yx.Ac

灰常感谢,原方法不但有越界,且考虑有疏漏,现已更正,欢迎继续讨论 @Elvin

View Article

作者:风之谷

dp中还是存在越界吧, for(int len = 2; len <= xlen; ++len) for(int begin = 0; begin < xlen+1-len; ++begin) int end = begin + len; 当len =xlen时,begin=0,此时,end就已经越界了。 而且,因为你下面表示的子串长度是len+1,所以begin <...

View Article

作者:Yx.Ac

@风之谷 已更正,谢谢!/握手

View Article

作者:风之谷

楼主的文章很不错哈,9月份要找工作,打算好好看看楼主的文章...

View Article


作者:Yx.Ac

@风之谷 哈,过奖,看你思路好清晰,欢迎指正,/握手

View Article

作者:小小路

O(n)解法中if(maxlen > i)   这个式子应该永远不会成立, LPS_rb[i] = MIN(LPS_rb[2*maxid-i],(maxlen-i)) 本应当是尽量减少不必要的运算次数的,然而没起到什么作用,我看了下其他网站的做法,其中maxlen = LPS_rb[i] + i。 ps:楼主的代码也能算出答案,只是那个 LPS_rb[i] =...

View Article

作者:写代码的小鬼头

请问解法二中的22行与23行,是否应该用maxlen+maxid代替maxlen?

View Article


作者:TLinger

@写代码的小鬼头 我也这样认为.

View Article


作者:Yx.Ac

好的,谢谢,我瞅瞅去

View Article
Browsing latest articles
Browse All 10 View Live




Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.1 by Vimeo.com, Inc.