You are viewing a single comment's thread. Return to all comments →
void miniMaxSum(vector<int> arr) { long int len = arr.size(); unsigned long int i,max=0,min=0,sum=0; for(i=0;i<len;i++){ sum += arr[i]; //arr.push_back(sum); } sort(arr.begin(), arr.end()); max= sum - arr[0]; min= sum - arr[len-1]; cout<<min<<"\t"; cout<<max; }
Seems like cookies are disabled on this browser, please enable them to open this website
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →