开发者

Longest common substring with constant memory?

Given two strings -- how can you find the longest common substring using only constant memory?

UPDATE: The time constraints are to solve it in O(len1 * len2), like the standard dynamic-programming solu开发者_如何学Ction.


Constant memory and no time constraints?

Just do a brute force approach: compare all possibilities, keeping just 6 integer indexes in memory: start and end for both strings, plus 2 for the longest string found yet...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜