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.
for(let i=0; i<arr.length;i++) {
let total = sort[arr[i][0]];
let current = arr[i][1];
if (i <= (arr.length/2)-1) {
current = '-';
}
if (total === undefined) {
sort[arr[i][0]] = [current];
} else {
total.push(current);
}
}
console.log(sort.flat().join(' '));
}
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 →
simple javascript solution
function countSort(arr) { let sort = [];
}