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
|
6065 Discussions
|
Please Login in order to post a comment
Java 7 Solution
long minValue= arr.get(0),maxValue = arr.get(0),sum=0;
For Python:
def miniMaxSum(arr): # Write your code here minNu= min(arr) maxNu=max(arr) total=sum(arr) print(total-maxNu,total-minNu)
C++ Solution. Corrected the function's signature to pass by const lvalue reference. Used STL max/min_element functions and accumulate for what would have been tedious loops.