1450. Number of Students Doing Homework at a Given Time
Given two integer arrays startTime and endTime and given an integer queryTime.
The ith student started doing their homework at the time startTime[i] and finished it at time endTime[i].
Return the number of students doing their homework at time queryTime. More formally, return the number of students where queryTime lays in the interval [startTime[i], endTime[i]] inclusive.
for一遍统计多少个区间包含了queryTime
class Solution(object): def busyStudent(self, startTime, endTime, queryTime): """ :type startTime: List[int] :type endTime: List[int] :type queryTime: int :rtype: int """ ans = 0 for i in range(len(startTime)): if startTime[i] <= queryTime <= endTime[i]: ans += 1 return ans

浙公网安备 33010602011771号