You are viewing a single comment's thread. Return to all comments →
Sort array and do one iteration through the array.
Arrays.sort(a); int min = a[0]; System.out.println(a.length); for (int i = 0; i < a.length; i++) { if (a[i] > min) { min = a[i]; System.out.println(a.length - i); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
Sort array and do one iteration through the array.