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.
- Mini-Max Sum
- Discussions
Mini-Max Sum
Mini-Max Sum
Sort by
recency
|
929 Discussions
|
Please Login in order to post a comment
my solution (Python):
If some one is looking for a go solution with quick sort method, here is mine (working for all size of array) :
Python solution (I tried to avoid loops, just for fun)
def miniMaxSum(arr): arr.sort() middle = sum(arr[i] for i in range(1,4)) minv = arr[0] + middle maxv = middle + arr[4]
if name == 'main':
In c++ i get this 2063136757 18446744072159051664 from 256741038 623958417 467905213 714532089 938071625 and i can't figure out why.....
I'm a newby but this one made me a bit happy... :)
// Javascript function miniMaxSum(arr) { // Write your code here
// console.log(arr)
let totalArray = [];
for(let i = 0; i < arr.length; i++){
console.log(
{Math.max(...totalArray)}
)}