LintCode:最长无重复字符的子串
2016-04-26 20:56
281 查看
LintCode:最长无重复字符的子串
class Solution: # @param s: a string # @return: an integer def lengthOfLongestSubstring(self, s): # write your code here L = [] max_len = 0 n = 0 i = 0 while i < len(s): for j in range(i, len(s)): if s[j] not in L: L.append(s[j]) n += 1 if n > max_len: max_len = n else: tmp = L.index(s[j]) i += tmp L = [] n = 0 break i += 1 return max_len
相关文章推荐
- LeetCode 50. Pow(x, n)
- (matlab)plot画图的颜色线型
- STL之空间配置器
- shape使用正确姿势
- JDBC03
- 关于企业应用架构模式总体分析
- GDB调试原理
- 关于java的Cliass类
- 操作系统典型调度算法
- 7. Reverse Integer
- 8. String to Integer (atoi)
- poj 2104 K-th Number(主席树,静态第k小)
- 让EditText无法点击编辑和RatingBar无法点击
- java中枚举类的使用详解
- #leetcode#21. Merge Two Sorted Lists
- 常见的解析方式(java)
- 我自己用的AHK脚本
- Tab切换
- 指针总结(—)
- 12. Integer to Roman