KMP pattern matching

hard

The failure function records, for each prefix, the longest proper prefix that is also a suffix - so a mismatch slides the pattern forward without re-reading a single character.

Worst O(n + m)Space O(m)
Loading the kmp pattern matching engine…

Where to go next