You are viewing a single comment's thread. Return to all comments →
Java: Collections.sort(arr); long min=0; long max=0; for(int i=0;i<4;i++){ min+=arr.get(i); } for(int j=4;j>=1;j--){ max+=arr.get(j); } System.out.println(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 →
Java: Collections.sort(arr); long min=0; long max=0; for(int i=0;i<4;i++){ min+=arr.get(i); } for(int j=4;j>=1;j--){ max+=arr.get(j); } System.out.println(min+" "+ max);