We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Warmup
- Mini-Max Sum
- Discussions
Mini-Max Sum
Mini-Max Sum
Sort by
recency
|
5949 Discussions
|
Please Login in order to post a comment
public static void miniMaxSum(List arr) { // Write your code here long minimum = arr.get(0); long maximum = arr.get(0);
Don't make want to make code is too coplicated to see for the beginers.
//Just on default package - collections
Collections.sort(arr); long Max=0L; long Min=0L; for(int A =0;A-1;B--){ if(B!=arr.size()-1){ Min=Min+arr.get(B); } } System.out.print(Min + " " +Max);
Collections.sort(arr);
Python 3 solution: