• + 0 comments

    public static void miniMaxSum(List arr) { // Write your code here long minimum = arr.get(0); long maximum = arr.get(0);

        long sum = 0;
    
        for(Integer element : arr) {
            if(minimum > element) {
                minimum = element;
            }
            if(maximum < element) {
                maximum = element;
            }
            sum+=element;
        }
        System.out.println((sum - maximum) + " " + (sum - minimum)) ;
    
    }