Longest Substring Without Repeating Characters
2014-12-17 21:42 李涛的技术博客 阅读(108) 评论(0) 编辑 收藏 举报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; }