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.
- Counting Sort 1
- Discussions
Counting Sort 1
Counting Sort 1
Sort by
recency
|
690 Discussions
|
Please Login in order to post a comment
why its not working for 5th test case def countingSort(arr): arr.sort() d=arr[-1] l=[] for i in range(d+1): count=0 for j in arr: if i==j: count+=1 l.append(count) return l
C#
mine python solution
correct solution according to hacker rank
My Java 8 Solution:
A couple Python solutions:
Fun one liner:
Not very optimal, O(n^2) time complexity
Better but more verbose solution for O(n) time complexity: