You are viewing a single comment's thread. Return to all comments →
My Java 15 based solution:
arr.sort(Comparator.reverseOrder()); long sum = arr.stream().mapToLong(num->num).sum(); long maxSum = sum - arr.get(arr.size()-1); long minSum = sum - arr.get(0); 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 →
My Java 15 based solution: