Z-Function vs KMP Failure Function in String Problems
Z-function works forward, KMP looks back—pick the one that matches your problem's natural direction.
Rohan Fontaine
Contributing Editor
Rohan Fontaine is a contributing editor at Competitive Programming Review covering string algorithms. Based in Seoul, Rohan has written for Competitive Programming Review since 2023.
1 story · Seoul
Z-function works forward, KMP looks back—pick the one that matches your problem's natural direction.