We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Scanner in = new Scanner(System.in);
List<Long> a = new ArrayList<>();
for(int i = 0; i < 5; i++)
a.add(new Long(in.nextLong()));
long min = a.stream().mapToLong(f -> f).min().getAsLong();
long max = a.stream().mapToLong(f -> f).max().getAsLong();
long sum = a.stream().mapToLong(f -> f).sum();
System.out.println((sum - max) + " " + (sum - min));
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →