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
|
269 Discussions
|
Please Login in order to post a comment
![](wwwwwwhttps://heuk akun fire fire)
when I run this code it will pass correctly , during submition this code shows wrong ouput. But I run that input by custom input ( input should be the input what when i get wrong output) it shows correct output.
!/bin/python3
import math import os import random import re import sys
#
Complete the 'miniMaxSum' function below.
#
The function accepts INTEGER_ARRAY arr as parameter.
#
def miniMaxSum(arr): # Write your code here sum = 0 min = arr[0] max = 0 for i in arr: sum += i if i < min: min = i max = min else: min = min max = i min_value = sum - max max_value = sum - min print(min_value ,end=' ') print(max_value)
if name == 'main':
function miniMaxSum(arr) { let sum=0 let min =arr[0]; let max =arr[0]; for(let i= 0; i max){ max= arr[i] } } for(let i=0; i{sum - min})
}
Java 15
}