You are viewing a single comment's thread. Return to all comments →
We use following loops for 5000000 numbers
Arrays.sort(arr); for(int i = 0; i<n-1;i++){ min += arr[i]; max += arr[i+1]; }
or
Arrays.sort(arr); for(int j=0;j<n-1;j++) min +=arr[j]; for(int i=1;i<n;i++) max +=arr[i]; System.out.printf(min+" "+max);
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 →
We use following loops for 5000000 numbers
or