The Full Counting Sort

  • + 1 comment

    After testing the code you provide, I finally found the mistake in my opinion :))
    I think the problem is in your string concatenation operation

    var result = '';  
    for (var i = 0; i < 100; i += 1) {  
        for (var j = 0; j < numbers[i].length; j += 1) { 
            process.stdout.write(numbers[i][j] + ' ');// add this line
            //result += numbers[i][j] + ' ';  // here is the problem
        }  
    }
    //console.log(result);
    

    The input size of testcase#5 is 10^6, so it might be too large for printing such a long string(the length of the string might be 10^6 or bigger) once a time!
    I'm not familiar with JS, hoping this will help u! :))