leetcode Longest Substring Without Repeating Characters python

学习python语法,用py写发尺取

学习了pthon中的map

要注意特判空字符串

class Solution:
    def lengthOfLongestSubstring(self, s):
        """
        :type s: str
        :rtype: int
        """
        dict  = {}
        l = len(s)
        if l==0 :
            return l
        for i in range(l):
            dict[s[i]] = -1
        a = 0
        b = 1
        ans = 1
        dict[s[a]] = 1
        while b


你可能感兴趣的:(python)