You are viewing a single comment's thread. Return to all comments →
Java solution:
public static void miniMaxSum(List<Integer> arr) { long min = 0; long max = 0; Collections.sort(arr); for(int i=0;i<arr.size()-1;i++){ min+=arr.get(i); } for(int i=1;i<arr.size();i++){ max+=arr.get(i); } 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 solution: