摘要:
1 class Solution { 2 public: 3 int maxSubArray(int A[], int n) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 int result; 7 if (n == 0) return result; 8 9 vector <int> record(n,0);10 record[0] = A[0]... 阅读全文
摘要:
1 class Solution { 2 public: 3 int lengthOfLongestSubstring(string s) { 4 int n = s.length(); 5 int i = 0, j = 0; 6 int maxLen = 0; 7 bool exist[256] = { false }; 8 while (j < n) { 9 if (exist[s[j]]) {10 maxLen = max(maxLen, j-i);11 while (s[i... 阅读全文