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