[릿코드 3] Longest Substring Without Repeating Characters (파이썬/python)
2023. 3. 20.
https://leetcode.com/problems/longest-substring-without-repeating-characters/ int: answer = 0 # key = char / value = index char_dic = {} left_idx = 0 for right_idx, char in enumerate(s): if char not in char_dic: answer = max(answer, (right_idx - left_idx + 1)) else: if char_dic[char] < left_idx: answer = max(answer, (right_idx - left_idx + 1)) else: left_idx = char_dic[char] + 1 char_dic[char] =..