本帖最后由 Miss_Allsunday 于 2017-6-17 08:27 编辑
3. Longest Substring Without Repeating Characters
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.
给一个字符串,找出其中最长的子字符串并且这个子字符串中没有重复的字符。 举例: 给"abcabcbb", 答案是"abc", 长度是3。 给"bbbbb", 答案是“b”,长度是1。 给"pwwkew",答案是“wke”,长度是3。注意答案必须是子字符串,“pwke”是个子序列,而不是子字符串。
你需要完成以下的函数: int lengthOfLongestSubstring(char* s) { int len = strlen(s);
}
这道题目的网址是:“https://leetcode.com/problems/longest-substring-without-repeating-characters/#/description” |