@@ -0,0 +1,656 @@
+class Solution(object):%0A    def lengthOfLongestSubstring(self, s):%0A        %22%22%22%0A        :type s: str%0A        :rtype: int%0A        %22%22%22%0A        if len(s) == 0:%0A            return 0%0A        if len(s) == 1:%0A            return 1%0A%0A        last_pos = %7B s%5B0%5D: 0 %7D%0A        longest_sub = %5B1%5D * len(s)%0A%0A        for i in range(1, len(s)):%0A            seen = last_pos.get(s%5Bi%5D, -1)%0A            if seen %3C i - longest_sub%5Bi - 1%5D:%0A                longest_sub%5Bi%5D = longest_sub%5Bi - 1%5D + 1%0A            else:%0A                longest_sub%5Bi%5D = i - seen%0A            last_pos%5Bs%5Bi%5D%5D = i%0A        return max(longest_sub)%0A%0Astr = 'abcabcbb'%0Aprint Solution().lengthOfLongestSubstring(str)

完成了 Longest Substring Without Repeating Characters