[英]Longest Common Subsequence for more than 2 strings
I'm not sure if that's the best answer, but I guess a DP approach could work here as well.我不确定这是否是最好的答案,但我想 DP 方法也可以在这里工作。 With 2 strings you make a 2D array and fill it with "match lengths" for different starting/ending indeces of both strings (depending on your approach).
使用 2 个字符串,您可以创建一个 2D 数组,并为两个字符串的不同起始/结束索引填充“匹配长度”(取决于您的方法)。 You could just use ND array for N strings, and fill it in the same way.
您可以只对 N 个字符串使用 ND 数组,并以相同的方式填充它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.