You are viewing a single comment's thread. Return to all comments →
long total = 0 ; long min = arr.get(0); long max = arr.get(0); for(int i: arr) { total += i ; if(i < min) { min = i ; } if(i > max) { max = i ; } } long minSum = total - max; long maxSum = total - min; System.out.print(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 →