We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
It took me a while to master the concept of the KMP algorithm but once I did, it was fairly straightforward to code the algorithm. The link provided didn't give a very clear explanation but there are many references on google/YouTube that did.
No credit to Hackerrank for providing a test case #0 that had no pattern strings with repetitions in them. One should not have to buy a test case to test the implementation of the pattern matching array.
I'm not sure that a program that modifies the elements of the pattern matching array counts as "functional" programming. I could have buried this inside a function that generates the array to begin with and made it look to the outside world as purely functional. I didn't bother with this deception.
Substring Searching
You are viewing a single comment's thread. Return to all comments →
It took me a while to master the concept of the KMP algorithm but once I did, it was fairly straightforward to code the algorithm. The link provided didn't give a very clear explanation but there are many references on google/YouTube that did.
No credit to Hackerrank for providing a test case #0 that had no pattern strings with repetitions in them. One should not have to buy a test case to test the implementation of the pattern matching array.
I'm not sure that a program that modifies the elements of the pattern matching array counts as "functional" programming. I could have buried this inside a function that generates the array to begin with and made it look to the outside world as purely functional. I didn't bother with this deception.