longest common prefix 和 longest common substring# JobHunting - 待字闺中
j*2
1 楼
longest common prefix:
这题就只有O(n*m)的解法了吧?n=最短的一个string的长度,m=string个数。
没更简便的了吧?
longest common substring:
这题的两种解法都要掌握吗?DP比较容易,但是时间复杂度要O(n1xn2)。suffix tree
时间复杂度是O(n1+n2),但是貌似很复杂,很想放弃了。有经验的大牛们,这题需要掌
握suffix算法吗?
这题就只有O(n*m)的解法了吧?n=最短的一个string的长度,m=string个数。
没更简便的了吧?
longest common substring:
这题的两种解法都要掌握吗?DP比较容易,但是时间复杂度要O(n1xn2)。suffix tree
时间复杂度是O(n1+n2),但是貌似很复杂,很想放弃了。有经验的大牛们,这题需要掌
握suffix算法吗?