Longest substring that appears n times
- by xcoders
For a string of length L, I want to find the longest substring that appears n (n<L) or more times in ths string.
For example, the longest substring that occurs 2 or more times in "BANANA" is "ANA", once starting from index 1, and once again starting from index 3. The substrings are allowed to overlap.
In the string "FFFFFF", the longest string…