You are viewing a single comment's thread. Return to all comments →
// java code
public static void miniMaxSum(List<Integer> arr) { long max = 0; long min = 0; for(int i = 0; i < arr.size(); i++) { long count = 0; for (int j = 0; j < arr.size(); j++) { if (j != i) { count += arr.get(j); } } if (count > max || max == 0) max = count; if (count < min || min == 0) min = count; } System.out.printf("%d %d", min, max); }
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 code