You are viewing a single comment's thread. Return to all comments →
My solution in java-
public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); long min,max,sum=0; min=in.nextLong(); max=min; sum=min; for(int i=0;i<4;i++){ long a = in.nextLong(); sum+=a; if(a<min){ min=a; } if(a>max){ max=a; } } System.out.print((sum-max)+" "+(sum-min)); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
My solution in java-