Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
self-explanatory solution in Clear category for Long Non Repeat by 1-more
def non_repeat(line):
w= len(line)
substrings= [line[i:i+j] for j in range(1,w+1) for i in range(w) if i+j<=w]
all_unique_letters= [s for s in substrings if len(set(s))==len(s)]
return max(all_unique_letters, key=len) if all_unique_letters else ''
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
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"?')
Feb. 22, 2018
Comments: