Question DSA-STR-0044
MediumWhat is the output of this code?
s = "abcabcbb"
seen, left, best = {}, 0, 0
for i, c in enumerate(s):
if c in seen and seen[c] >= left:
left = seen[c] + 1
seen[c] = i
best = max(best, i - left + 1)
print(best)
- A.
3
- B.
8
- C.
Sign up free to see the answer and a step-by-step explanation.