标签:style blog ar color sp on div log bs
int longestSubString(char* arr, int len) { if (arr == NULL || len <= 0) return 0; int i = 0, j = 0; int maxLen = 0; bool exist[256] = { false }; while (j < len) { if (exist[s[j]]) { maxLen = max(maxLen, j-i); while (s[i] != s[j]) { exist[s[i]] = false; i++; } i++; j++; } else { exist[s[j]] = true; j++; } } maxLen = max(maxLen, len-i); return maxLen; }
Longest Substring Without Repeating Characters
标签:style blog ar color sp on div log bs
原文地址:http://www.cnblogs.com/litao-tech/p/4170507.html