You are viewing a single comment's thread. Return to all comments →
Java
public static void miniMaxSum(List<Integer> arr) { // Write your code here long min = Long.MAX_VALUE, max = Long.MIN_VALUE, sum = 0; for (Integer num : arr) { min = Math.min(min, num); max = Math.max(max, num); sum += num; } System.out.println((sum - max) + " " + (sum - min)); }
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