Problems > Longest Repeat > Editorial

Longest Repeat — Solution & Editorial

Back to the Problem

The longest repeated substring is the maximum LCP between two suffixes — i.e. the maximum value in the LCP array of the suffix array.

Complexity: O(n log n)