[LeetCode]Longest Substring Without Repeating Characters
·
SW개발/코딩테스트
https://leetcode.com/problems/longest-substring-without-repeating-characters/ int: # 문자열이 고유한 단어들로만 이루어진 경우, 문자열의 길이 자체가 정답입니다. if len(set(s)) == len(s): return len(s) substring = '' max_len = 1 for i in s: # substring에 들어있지 않은 문자인 경우에만 substring을 추가하고, max_len 값을 업데이트 합니다. if i not in substring: substring = substring + i max_len = max(max_len, len(substring)) # 이미 substring에 있는 문자가 다시 등장한다면 # 이..