You are viewing a single comment's thread. Return to all comments →
Simple code in java
public class Solution { static int num; public static void main(String[] args) { Scanner se=new Scanner(System.in); int n=se.nextInt(); int ar[]=new int[n]; int num[]=new int[n]; int max=0; for(int i=0;i<n;i++){ ar[i]=se.nextInt(); if(ar[i]>max) max=ar[i]; num[ar[i]]++; } for(int i=0;i<=max;i++){ for(int j=0;j<num[i];j++){ System.out.print(i+" "); } } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Counting Sort 2
You are viewing a single comment's thread. Return to all comments →
Simple code in java