Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Brute force with str.count solution in Clear category for Double Substring by PythonWithPI
def double_substring(line):
"""
length of the longest substring that non-overlapping repeats more than once.
"""
for length in range(len(line),0,-1):
for start in range(len(line)-length+1):
if line.count(line[start:start+length])>1:
return length
return 0
Feb. 17, 2019
Comments: