• + 0 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]);
        }