You are viewing a single comment's thread. Return to all comments →
In Java
long sumMin=0; long sumMax=0; Collections.sort(arr); for(int i=0;i<arr.size();i++) { if(i != 0) { sumMax +=(long)arr.get(i); } if(i!=4) { sumMin +=(long)arr.get(i); } } System.out.println(sumMin+" "+sumMax);
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 →
In Java