0

假设有大量单个单词(不是短语)的数组,例如

{"One", "two", "three", "four"}
{"One", "two", "three"}
{"One", "two", "where", "are", "you"}
{"One", "other"}
{"Two", "three", "four"}
{"More", "more", "more"}

给定另一个单词数组,除了“蛮力”解决方案(即连续字符串匹配)之外,从左到右查找最长共同匹配的最有效(最快)方法是什么?

例如,给定数组{"One", "two", "three", "four", "five"},上面列表中最长的共同匹配是{"One", "two", "three", "four"}.

4

0 回答 0