Return the length of the longest substring that occurs at least twice in s (the two occurrences may overlap). Return 0 if every letter occurs once.
For "banana" the answer is 3 ("ana").
The starter code builds every substring of every length. It is correct but too slow for long strings.
Example 1
Input:
longest_repeated_length('banana')
Output:
3
Example 2
Input:
longest_repeated_length('abcd')
Output:
0
0 <= len(s) <= 20000No results yet
Run your code to check it against the examples, or submit to run every test.