Easy
Number of Students Doing Homework at a Given Time — Python
Full explanation · Time O(n) · Space O(1)
# Time: O(n)
# Space: O(1)
import itertools
class Solution(object):
def busyStudent(self, startTime, endTime, queryTime):
"""
:type startTime: List[int]
:type endTime: List[int]
:type queryTime: int
:rtype: int
"""
return sum(s <= queryTime <= e for s, e in itertools.izip(startTime, endTime))