You are viewing a single comment's thread. Return to all comments →
Java 7 Solution
long minValue= arr.get(0),maxValue = arr.get(0),sum=0;
for(long x:arr) { if(x<=minValue) minValue =x; if(x>=maxValue) maxValue = x; sum+=x; } System.out.print((sum-maxValue)); System.out.println(" "+(sum-minValue));
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 7 Solution
long minValue= arr.get(0),maxValue = arr.get(0),sum=0;