KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Trying to solve the following problem: Given a string of arbitrary length, find the longest substring that occurs more than one time within the string, with no overlaps. For example, if the input string was ABCABCAB , the correct output would be ABC . You couldn't say ABCAB , because that only occurs twice where the two substrings overlap, which is not allowed. Is there any way to solve this reasonably quickly for strings containing a few thousand characters? (And before anyone asks, this is not homework. I'm looking at ways to optimize the rendering of Lindenmayer fractals, because they tend to take excessive amounts of time to draw at high iteration levels with a naive turtle graphics system.)
Tags (comma-separated)
Save Edits
Cancel