You are viewing a single comment's thread. Return to all comments →
One iteration is definitely possible, but finding min,max,and sum values all at once is more intuitive than editing the sum value:
arr = list(map(int, input().strip().split(' '))) max=-sys.maxsize-1 min=sys.maxsize sum=0 for x in arr: sum+=x if x>max: max=x if x<min: min=x print (sum-max,sum-min)
Seems like cookies are disabled on this browser, please enable them to open this website
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
One iteration is definitely possible, but finding min,max,and sum values all at once is more intuitive than editing the sum value: