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 Magu
def non_repeat(line):
st = ''; mx = ''
for m in range(len(line)):
for n in range(m, len(line)):
if line[n] in st:
if len(st) > len(mx):
mx = st
st = ''
break
st += line[n]
if not mx: return line
return mx
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert non_repeat('fghfrtyfgh') == 'ghfrty'
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"?')
Oct. 20, 2021
Comments: