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.
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)
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
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':