You are viewing a single comment's thread. Return to all comments →
c++20
void miniMaxSum(vector<int> arr) { size_t min = numeric_limits<size_t>::max(); size_t max = numeric_limits<size_t>::min(); size_t total = 0; for(size_t value : arr){ total += value; if(value < min){ min = value; } if(value > max){ max = value; } } std::cout << total-max << " " << total-min << 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++20