You are viewing a single comment's thread. Return to all comments →
Collections.sort(arr);
long Max=0L; long Min=0L; for(int A =0;A<arr.size();A++){ if(A!=0){ Max=Max+arr.get(A); } } for(int B = arr.size()-1;B>-1;B--){ if(B!=arr.size()-1){ Min=Min+arr.get(B); } } System.out.print(Min + " " +Max);
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 →
Collections.sort(arr);