字符串数组中最长的单词匹配

时间:2014-12-03 04:56:40

标签: java match longest-prefix

假设一大组单个单词(不是短语),例如

{"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"}

0 个答案:

没有答案