Skip to content

s9e/LongestCommonSubstring

Repository files navigation

s9e\LongestCommonSubstring takes a list of strings and returns a single string that is contained in all of the given input. The implementation is designed for sets where the shortest input string is 10-20 bytes long at most, and where a common substring is not guaranteed to exist. For large input, you'll want to use a different implementation.

Usage

$lcs = new s9e\LongestCommonSubstring\LongestCommonSubstring;
var_dump($lcs->get(['abcdxyz', 'xyzabcd']));
string(4) "abcd"
$lcs = new s9e\LongestCommonSubstring\LongestCommonSubstring;
var_dump($lcs->get(['foo', 'bar']));
string(0) ""

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages