You are viewing a single comment's thread. Return to all comments →
Omg it keeps throwing exceptions because I keep using arr.Sort(). So this is what I did in C#
public static void miniMaxSum(List<int> arr) { long min, max, total = 0; foreach(int num in arr){ total += num; } arr = arr.OrderBy(x=>x).ToList(); min = total - arr[4]; max = total - arr[0]; Console.WriteLine(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 →
Omg it keeps throwing exceptions because I keep using arr.Sort(). So this is what I did in C#