Z-Algorithm (Z-Function) Interactive Visualizer
The Z-Algorithm computes for every position i the length of the longest substring starting at i that matches a prefix of the string in linear O(n) time using a sliding Z-box.
Study Z-Algorithm (Z-Function) Explanation · View Multi-Language Code · All Algorithms