Longest repeated substring (source code)

= Longest repeated substring

= Longest repeated segment
{synonym}

A longest repeated substring is a maximum-length contiguous <string> occurring at two distinct starting positions in a text. The occurrences may overlap unless a nonoverlap constraint is explicitly imposed. It can be found by comparing all pairs of suffixes, or by taking the maximum longest-common-prefix length of adjacent entries of a <suffix array>. The latter characterization concerns correctness; the time needed to build the <suffix array> depends on the construction algorithm.