➽ Problem:-

https://www.hackerrank.com/challenges/mini-max-sum/problem

➽ Solution:-

import java.util.*;

import java.io.*;

 

public class Solution

{

    public static void main(String args[])

    {

        int arr[] = new int[5];

        Scanner sc = new Scanner(System.in);

       

        for(int i=0; i<5; i++)

        {

            arr[i] = sc.nextInt();

        }

        Arrays.sort(arr);

        long max = 0;

        long min = 0;

        for(int i=0; i<4; i++)

        {

            min += arr[i];

            max += arr[i+1];

        }

        System.out.println(min + " " + max);

    }

}