Counting Sort 1

  • + 2 comments

    Can anyone explain why this wouldn't pass all test cases?

    def countingSort(arr):
        new_arr = [0]*(max(arr)+1)
        for val in arr:
            new_arr[val] += 1
        return new_arr