I have this code:
module.exports = function (N, staff, K) {
staff.sort((a, b) => b - a);
let sliced = staff.slice(0, K);
return sliced.slice(0, K).reduce((a, b)=>{
return a+b
}, 0);
}
I would like to hear your suggestions on how to speed up its execution as much as possible