We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<bits/stdc++.h>#include<numeric>usingnamespacestd;stringltrim(conststring&);stringrtrim(conststring&);vector<string>split(conststring&);/* * Complete the 'miniMaxSum' function below. * * The function accepts INTEGER_ARRAY arr as parameter. */voidminiMaxSum(vector<int>arr){sort(arr.begin(),arr.end());longlongmax_sum=accumulate(arr.begin()+1,arr.end(),0LL);longlongmin_sum=accumulate(arr.begin(),arr.begin()+arr.size()-1,0LL);cout<<min_sum<<" "<<max_sum<<endl;}
Cookie support is required to access HackerRank
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 →