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ť saTests12
Visible tests
Skrytý test 7
Skrytý test 8
Skrytý test 9
Skrytý test 10
Skrytý test 11
Skrytý test 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid