Longest Substring Without Repeating Characters 题解
Last updated
Was this helpful?
Last updated
Was this helpful?
题目来源:
> 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.
解题思路:
记录上一次出现同字符到当前字符的长度,如下图。
注意数组初始化, int table[256]={-1}; //只有第一个为-1,其他为0.
我不会告诉你我参考了.