You are viewing a single comment's thread. Return to all comments →
int incl = 0, excl = 0, temp; for(int i = 0; i < arr.size(); i++) { temp = incl; incl = max(arr[i]+excl, temp); excl = temp; } return max(incl, excl);
Seems like cookies are disabled on this browser, please enable them to open this website
Max Array Sum
You are viewing a single comment's thread. Return to all comments →