Longest repeated substring problem
In computer science, the longest repeated substring problem is the problem of finding the longest substring of a string that occurs at least twice.[src] This problem can be solved in linear time and space \Theta(n) by building a suffix tree for the string (with a special end-of-string symbol like '$' appended), and finding the deepest internal node in the tree with more than one child.[src] Depth is measured by the number of characters traversed from the root.[src] The string spelled by the edges from the root to such a node is a longest repeated substring.[src] The problem of finding the longest substring with at least k occurrences can be solved by first preprocessing the tree to count the number of leaf descendants for each internal node, and then finding the deepest node with at least k leaf descendants.[src] To avoid overlapping repeats, you can check that the list of suffix lengths has no consecutive elements with less than prefix-length difference.[src] In the figure with the string "ATCGATCGA$", the longest substring that repeats at least twice is "ATCGA".[src]
In computer science, the longest repeated substring problem is the problem of finding the longest substring of a string that occurs at least twice.[src] This problem can be solved in linear time and space \Theta(n) by building a suffix tree for the string (with a special end-of-string symbol like '$' appended), and finding the deepest internal node in the tree with more than one child.[src] Depth is measured by the number of characters traversed from the root.[src] The string spelled by the edges from the root to such a node is a longest repeated substring.[src] The problem of finding the longest substring with at least k occurrences can be solved by first preprocessing the tree to count the number of leaf descendants for each internal node, and then finding the deepest node with at least k leaf descendants.[src] To avoid overlapping repeats, you can check that the list of suffix lengths has no consecutive elements with less than prefix-length difference.[src] In the figure with the string "ATCGATCGA$", the longest substring that repeats at least twice is "ATCGA".[src]
14 sentences · 14 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Longest repeated substring problem." encyclopegia.org, 2025, https://encyclopegia.org/wiki/longest-repeated-substring-problem. Accessed 04 December 2026.
Chicago
"Longest repeated substring problem." encyclopegia.org. Accessed December 4, 2026. https://encyclopegia.org/wiki/longest-repeated-substring-problem.
APA
encyclopegia.org. (2025). Longest repeated substring problem. Retrieved December 4, 2026, from https://encyclopegia.org/wiki/longest-repeated-substring-problem
Accessed December 4, 2026 · CC BY-SA 4.0 · citation page · JSON