Sort by

recency

|

5982 Discussions

|

  • + 0 comments
    def miniMaxSum(arr):
        arr.sort()
        a = arr[0] + arr[1] + arr[2] + arr[3]
        b = arr[4] + arr[1] + arr[2] + arr[3]
        print(str(a) + " " + str(b))
    
  • + 0 comments

    Hello, I'm new here and beginer of coding course.

    Always appreciate your assistance while using coding practice in my site https://kaartbonus.nl/

  • + 0 comments
    sort(arr.begin(), arr.end());
    int minsum = arr[0]+arr[1]+arr[2]+arr[3];
    int maxsum= arr[1]+arr[2]+arr[3]+arr[4];
    cout<<minsum<<maxsum<<endl;
    
  • + 0 comments

    def miniMaxSum(arr): # Write your code here arr.sort() min_sum = 0 max_sum = 0 n = len(arr)-1 for i in range(n+1): if i 0: max_sum += arr[i] print(min_sum, max_sum)

  • + 0 comments

    Typescript:

    let sum = 0;
    let minVal = Infinity; 
    let maxVal = 0;
    for (let i of arr) {
       sum += i;
       if (i < minVal) minVal = i;
       if (i > maxVal) maxVal = i;
    }
    console.log(sum - maxVal, sum - minVal);