You are viewing a single comment's thread. Return to all comments →
long valMx = 0, valMn = 0; arr.sort((a,b)->(a.compareTo(b))); for(int i = 0; i < arr.size()-1; i ++ ){ valMn += arr.get(i); valMx +=arr.get(i+1); } System.out.print(valMn+" "+valMx); }
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 →