Closed sgtlaugh closed 4 years ago
Add method to calculate the Z-Function in O(N). The Z-Function is useful in various string matching problems, like the classic pattern matching problem, calculating distinct substrings, etc.
Please consider pajenegod's comments from Discord as well.
Thanks @cheran-senthil. Updated the PR and also explained the reasoning in Discord. Cheers!
Add method to calculate the Z-Function in O(N). The Z-Function is useful in various string matching problems, like the classic pattern matching problem, calculating distinct substrings, etc.