79785396

Date: 2025-10-08 11:24:39
Score: 1
Natty:
Report link

This is based on @Karoly Horvath answers , tried to implement it in python code.

#Longest unique substring
st = 'abcadbcbbe'
left = 0 
max_len = 0
seen = set()

for right in range(len(st)):
    while st[right] in seen:
        seen.remove(st[left]) 
        left += 1
    seen.add(st[right])
    
    if (right - left) + 1 > max_len:
        max_len = (right - left) + 1
        start = left

print(st[start:start + max_len])
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @answers
  • Low reputation (0.5):
Posted by: Swarup Chavan