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.
well i did something similar as your's but ur code is better
importjava.io.*;importjava.util.*;publicclassSolution{publicstaticvoidmain(String[]args){/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */Scannersc=newScanner(System.in);intn=sc.nextInt();intarr[]=newint[n];for(inti=0;i<n;i++){arr[i]=sc.nextInt();}Arrays.sort(arr);intmin=arr[0];for(inti=0;i<n;){System.out.println(arr.length-i);i++;while(arr[i]==min){i++;}min=arr[i];}}}
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
well i did something similar as your's but ur code is better