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): min_sum = sum(arr[1:]) max_sum = sum(arr[1:]) len_of_arr = len(arr) for i in range(len_of_arr): temp = 0 for j in range(len_of_arr): if j==i: continue else: temp += arr[j] if temp < min_sum: min_sum = temp if temp > max_sum: max_sum = temp print(min_sum, max_sum) if __name__ == '__main__': arr = list(map(int, input().rstrip().split())) miniMaxSum(arr)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter