标签:col code def str div 方法 turn range int
class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ str_dic = {} i, ans = 0, 0 for j in range(len(s)): if s[j] in str_dic: i = max(str_dic[s[j]], i) ans = max(ans, j-i+1) str_dic[s[j]] = j + 1 return ans
标签:col code def str div 方法 turn range int
原文地址:https://www.cnblogs.com/xiao-xue-di/p/10287135.html