You are viewing a single comment's thread. Return to all comments →
C++ solution
void miniMaxSum(vector<int> arr) { std::sort(arr.begin(), arr.end()); std::cout << std::accumulate(arr.begin(), arr.begin() + 4, (long)0) << " "; std::cout << std::accumulate(arr.end() - 4, arr.end(), (long)0) << std::endl; }
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 →
C++ solution