Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.

Problem Statement: here

**Solution**: We need to just sort the number and get sum of first 4 numbers and then take sum of last 4 numbers.

```
``````
#!/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):
arr.sort()
print(sum(arr[:4]),sum(arr[-4:]))
**
if __name__ == '__main__':
arr = list(map(int, input().rstrip().split()))
miniMaxSum(arr)

From above code, we need to sort the list and then take first 4 letter from starting and 4 letter from end then print the sum of both sublist.

## 0 Comments