题目
思路
先遍历startTime,若queryTime大于等于startTime,这时候再去找到对应的endTime和startTime比较
代码
class Solution(object):
def busyStudent(self, startTime, endTime, queryTime):
"""
:type startTime: List[int]
:type endTime: List[int]
:type queryTime: int
:rtype: int
"""
i = 0
count=0
while i<len(startTime):
if queryTime>=startTime[i]:
if queryTime <=endTime[i]:
count+=1
i+=1
return count