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.
publicstaticList<Integer>countingSort(List<Integer>arr){//creates list with 100 elements filled with zerosList<Integer>res=newArrayList<Integer>(Collections.nCopies(100,0));for(Integera:arr)res.set(a,res.get(a)+1);returnres;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Counting Sort 1
You are viewing a single comment's thread. Return to all comments →
Easy Java solution: