leet code 003:Longest Substring Without Repeating Characters
来源:互联网 发布:学校网络下载不了 编辑:程序博客网 时间:2024/06/16 03:52
题目描述:
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1.
题目大意:
给定一个字符串,从中找出不含重复字符的最长子串的长度。例如,"abcabcbb"的不含重复字母的最长子串为"abc",其长度是3。"bbbbb"的最长子串是"b",长度为1。
解题思路:
按顺序拾取未出现过的字符
Python代码:
def find_diff(n): l=len(n) st='' for i in range(l): if n[i] not in st: st+=n[i] l=len(st) print('The string "'+n+'" without repeating letters is "'+st+'" , and the lenth is '+str(l))str001=input('Please input some strings:')find_diff(str001)
阅读全文
0 0
- leet code 003:Longest Substring Without Repeating Characters
- 【Leet Code】Longest Substring Without Repeating Characters
- Leet Code Medium 3 Longest Substring Without Repeating Characters
- Leet Code OJ 3. Longest Substring Without Repeating Characters
- CODE 127: Longest Substring Without Repeating Characters
- Leet Code 3. Longest Substring Without Repeating Characters (最长的没有重复字符的子字符串)
- LeetCode 003 Longest Substring Without Repeating Characters
- LeetCode-003 Longest Substring Without Repeating Characters
- 【leetcode】003 Longest Substring Without Repeating Characters
- LeetCode 003 Longest Substring Without Repeating Characters
- LeetCode 003-Longest Substring Without Repeating Characters
- [LeetCode]-003-Longest Substring Without Repeating Characters
- LeetCode #003 Longest Substring Without Repeating Characters
- LeetCode 003 Longest Substring Without Repeating Characters
- 003 Longest Substring Without Repeating Characters [Leetcode]
- 003 - Longest Substring Without Repeating Characters
- [LeetCode]003-Longest Substring Without Repeating Characters
- 003Longest Substring Without Repeating Characters (C)
- hdu 2050
- angularjs学习文档(1)
- Codeforces Round #434 (Div. 2, based on Technocup 2018 Elimination Round 1) ABCDF
- EasyDSS高性能流媒体服务器前端重构(六)- webpack-dev-server 支持手机端访问
- 数据处理收集
- leet code 003:Longest Substring Without Repeating Characters
- TCP/IP的开肠破肚(2)
- spring boot 之 redis
- Linux防火墙(Iptables)的开启与关闭
- 网站建设时需要避免这些心理
- 【总结】】maven错误及解决,持续更新~
- jQuery UI 实例
- 利用HorizontalScrollView自己写一个viewPager指示器
- 技术文章 | Python和Ruby两大语言全方位对比