Created
April 17, 2023 20:16
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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