Longest Substring Without Repeating Characters
来源:互联网 发布:淘宝确认收货前换货 编辑:程序博客网 时间:2024/06/02 05:27
Given a string, find the length of the longest substring without repeating characters.
Examples:
Given “abcabcbb”, the answer is “abc”, which the length is 3.
Given “bbbbb”, the answer is “b”, with the length of 1.
Given “pwwkew”, the answer is “wke”, with the length of 3. Note that the answer must be a substring, “pwke” is a subsequence and not a substring.
int lengthOfLongestSubstring(string s) { vector<int> dict(256, -1); int start = -1, maxLen = 0; for (int i = 0; i < s.length(); i++) { if (dict[s[i]] > start) { start = dict[s[i]]; } maxLen = max(maxLen, i - start); dict[s[i]] = i; } return maxLen; }
0 0
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- Longest Substring Without Repeating Characters
- xrandr 常用命令 用于双显示器 切换屏幕
- Android WebView 因重定向无法正常goBack()的一种解决小方案
- sqlite jdbc 访问resource下的数据库
- 正则表达式
- Struts(9)Struts的文件上传和下载及UUID类的使用
- Longest Substring Without Repeating Characters
- Delphi XE 10 跨平台三层数据库应用教程
- Unity调试时oculus中无画面,Touch手柄无效
- gdb set写text/code段错误的解决办法
- IE不支持xpath
- nginx代理php-fpm配置
- [Android]笔记2-简单图片浏览器
- 机器学习知识点(二十三)黎曼流形认知
- RHEL-RH134-UNIT6-文本处理工具