We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
While this works because you're adding n negative numbers (which will always be less than the positive number k), it's kind of an odd way to think about it. I think counting the number of on-time students would make more sense.
print( "YES" if len([1 for x in a if x <= 0]) >= k else "NO")
Cookie support is required to access HackerRank
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 →
While this works because you're adding n negative numbers (which will always be less than the positive number k), it's kind of an odd way to think about it. I think counting the number of on-time students would make more sense.
print( "YES" if len([1 for x in a if x <= 0]) >= k else "NO")