주어진 문자열에서 반복되지 않는 최장 부분문자열의 길이 출력
Time complexity:
Space complexity:
from collections import deque
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
q = deque()
start = 0
answer = 0
for e in range(len(s)):
while q and s[e] in q:
q.popleft()
q.append(s[e])
answer = max(answer, len(q))
return answer