You are viewing a single comment's thread. Return to all comments →
Not sure if it was just me, but from the problem description I understood to return YES in case more students are on time than the threshold:
...so class will go on. Return YES
Actually we should return YES in case of the class is cancelled and NO in case the class will go on.
JavaScript solution:
function angryProfessor(k, a) { const nrOfStudentsOnTime = a.filter((arrivalTime) => arrivalTime <= 0).length; return (nrOfStudentsOnTime >= k) ? "NO" : "YES"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Angry Professor
You are viewing a single comment's thread. Return to all comments →
Not sure if it was just me, but from the problem description I understood to return YES in case more students are on time than the threshold:
Actually we should return YES in case of the class is cancelled and NO in case the class will go on.
JavaScript solution: