You are viewing a single comment's thread. Return to all comments →
void miniMaxSum(vector<int> arr) { long long s=arr[0], m=arr[0], sum=arr[0], c, n=arr.size(); for(int i=1; i<n; i++){ c = arr[i]; m = max(c,m); s = min(c,s); sum += c; } cout << sum-m << " " << sum-s; }
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 →