Sort by

recency

|

6059 Discussions

|

  • + 0 comments

    Java 15 Solution:

    public static void miniMaxSum(List<Integer> arr) {
        // Write your code here
        Integer min=Collections.min(arr);
        Integer max=Collections.max(arr);
        Long sumLong=0L;
        for (Integer integer : arr) {
            sumLong+=integer;
        }
        System.out.print(sumLong-max+" ");
        System.out.print(sumLong-min);
    
        }
    
  • + 0 comments

    ** Python Code** arr_sort = sorted(arr) print(f'{sum(arr_sort[0:4])} {sum(arr_sort[1:])}')

  • + 0 comments
    public static void miniMaxSum(List<Integer> arr) {
        // Write your code here
    
            long totalSum = 0;
            int minNumber = Integer.MAX_VALUE;
            int maxValue = Integer.MIN_VALUE;
        
            for (Integer integer : arr) {
                
                minNumber = Math.min(minNumber , integer);
                maxValue = Math.max(maxValue, integer);
                totalSum += integer;
            }
            
            System.out.print(totalSum - maxValue + " ");
            System.out.println(totalSum - minNumber);
            
        }
    
  • + 0 comments

    !/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 maxs = sum(arr)-max(arr) mins = sum(arr)-min(arr) return maxs, mins if name == 'main':

    arr = list(map(int, input().rstrip().split()))
    a,b = miniMaxSum(arr)
    print(a,b)
    
  • + 0 comments

    solution in python using inbuilt functions..

    def miniMaxSum(arr):

    maxs=sum(arr)-min(arr)
    mins=sum(arr)-max(arr)
    print(mins,maxs)