Counting Sort 1

  • + 1 comment

    JS:

    /*
     * Complete the 'countingSort' function below.
     *
     * The function is expected to return an INTEGER_ARRAY.
     * The function accepts INTEGER_ARRAY arr as parameter.
     */
    
    function countingSort(arr) {
        const zeroes = Array(100).fill(0)
        for (const num of arr) zeroes[num]++
        
        return zeroes
    }