Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
遵循下面提到的算法子字符串序列
Follow the bellow mentioned algorithm sub-string sequence
我还没有测试过这个,我已经发现并修复了一个错误,但我想我现在已经涵盖了所有基础。您在问题中没有详细说明的一个限制是存在两个长度相等的子字符串的情况。即abbbcccdef,我只返回第一个。
I haven't tested this and I found and fixed one error already, but I think I've covered all the bases now. One limitation you didn't elaborate on in your question was the case in which there are two substrings of equal, longest length. i.e. abbbcccdef, I just return the first.
以下是我如何实现从字符串中查找最长的子字符串。
测试一下: http://ideone.com/JM904Y
Here is how I implemented to find a longest SubString from a String.
Test it: http://ideone.com/JM904Y