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 Vasily__Chibilyaev
def non_repeat(line):
return max((line[i:j+1] for i in range(len(line)) for j in range(i, len(line))),\
key = lambda x: len(set(x)) if len(x)==len(set(x)) else 0, default='')
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert non_repeat('aaa') == 'a', "First"
assert non_repeat('abdjwawk') == 'abdjw', "Second"
assert non_repeat('abcabcffab') == 'abcf', "Third"
print('"Run" is good. How is "Check"?')
April 2, 2018
Comments: