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