Implement KMP and Rabin-Karp Search

failure function and rolling hash

Challenge 5 of Arrays & StringsAdvanced~60 minFree

Build the substring-search toolkit that powers grep, DNA sequence search, and plagiarism detection. Start with brute force, then implement the KMP failure function and linear-time scan, add a Rabin-Karp rolling hash, and finish with hash-based repeated-substring detection.

5 steps

  1. 1Naive Search
  2. 2KMP Failure Function
  3. 3KMP Search
  4. 4Rabin-Karp Rolling Hash
  5. 5Repeated Substring Detection
Start step 1