You are viewing a single comment's thread. Return to all comments →
public static void miniMaxSum(List arr) { // Write your code here long minimum = arr.get(0); long maximum = arr.get(0);
long sum = 0; for(Integer element : arr) { if(minimum > element) { minimum = element; } if(maximum < element) { maximum = element; } sum+=element; } System.out.println((sum - maximum) + " " + (sum - minimum)) ; }
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 →
public static void miniMaxSum(List arr) { // Write your code here long minimum = arr.get(0); long maximum = arr.get(0);