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.
defcountSort(n,arr):#useninsteadoflen(arr)forlinarr:l[0]=int(l[0])#convertfirstlistitemtointegerforiinrange(n//2): # replace first half with hyphenarr[i][1]="-"# sort by number into empty list arrayoutput=[[]for_inrange(n)]forlinarr:output[l[0]].append(l[1])print(' '.join(jforiinoutputforjini))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Full Counting Sort
You are viewing a single comment's thread. Return to all comments →
Using sort now fails some of the test cases.
Here is my code