Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LuisitoRizado/77c6ec026f138be0157ade8e8852035c to your computer and use it in GitHub Desktop.
Save LuisitoRizado/77c6ec026f138be0157ade8e8852035c to your computer and use it in GitHub Desktop.
This is a possible solution for the 'Angry Professor' Challenge by Hackerrank, you can use it for free
function angryProfessor(k, a) {
// Write your code here
let alumnsLate = 0;
//Lets travel the loop
//we've gotta travel the loop searching
//if the element (time) is higher than 0
//than would mean that the alumn was late
for(let i = 0; i<a.length; i++){
if(a[i]<=0){
alumnsLate++;
}
}
if(alumnsLate>=k){
return 'NO'
}
else{
return 'YES'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment