You are viewing a single comment's thread. Return to all comments →
Nobody said I can't sort the elements vector, so I used std::sort
Difference(vector<int>elements){ this->elements = elements; } void computeDifference(){ sort(elements.begin(),elements.end()); this->maximumDifference = abs(elements[elements.size()-1]-elements[0]); }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 14: Scope
You are viewing a single comment's thread. Return to all comments →
Nobody said I can't sort the elements vector, so I used std::sort