Class Cancellation
The professor will only start class if enough students arrive by the beginning. The function angry_professor receives the minimum required number of students k and a list of arrival times a: a value of 0 or less means the student arrived on time. Count how many students made it on time and return YES if the class is cancelled, otherwise return NO.
Примеры
Ввод
3, [-1, -3, 4, 2]Вывод
"YES"Ввод
2, [0, -1, 2, 1]Вывод
"NO"Ввод
1, [5]Вывод
"YES"Нужно реализовать
def angry_professor(k: int, a: list[int]) -> str:
Теги
arraymath
Prihláste sa, aby ste videli históriu odoslaní
Prihlásiť saPrihláste sa, aby ste mohli používať AI mentora
Prihlásiť saVisible tests
1
Input
3, [-1,-3,4,2]Expected
"YES"2
Input
2, [0,-1,2,1]Expected
"NO"3
Input
1, [5]Expected
"YES"4
Input
1, [0]Expected
"NO"5
Input
2, [-5,-4,-3]Expected
"NO"6
Input
1000, [0,-2,5,3]Expected
"YES"Focus radio
Paused · SomaFM · Fluid