Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Long Non Repeat by 9maksim
def non_repeat(line):
max = ""
for i in range(len(line)):
for j in range(1, len(line) + 1):
current = line[i:j]
if len(current) == len(set(current)):
if len(max) < len(current):
max = current
else:
break
return max
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert non_repeat('w') == 'w', "First"
assert non_repeat('aaaaa') == 'a', "First"
assert non_repeat('abdjwawk') == 'abdjw', "Second"
assert non_repeat('abcabcffab') == 'abcf', "Third"
print('"Run" is good. How is "Check"?')
Jan. 7, 2020
Comments: