Two Pointers
28. Find the Index of the First Occurrence in a String
Naive substring search is O(n·m); KMP deletes the rewind by precomputing a prefix function so the haystack pointer only ever moves forward — linear time.
Loading…
Naive substring search is O(n·m); KMP deletes the rewind by precomputing a prefix function so the haystack pointer only ever moves forward — linear time.
Loading…