Imagine you're a teaching assistant monitoring a study hall. You have records of when each student started and finished their homework, and you need to quickly answer the question: "How many students were actively doing homework at a specific time?"
You're given two integer arrays: startTime and endTime, where the i-th student began their homework at time startTime[i] and completed it at time endTime[i]. Additionally, you're given a queryTime.
Your task is to return the number of students who were doing homework at the exact moment specified by queryTime. A student is considered to be doing homework at queryTime if the query time falls within their work interval [startTime[i], endTime[i]] inclusive.
Example: If a student worked from time 2 to time 5, they were doing homework at times 2, 3, 4, and 5.
Input & Output
Constraints
- startTime.length == endTime.length
- 1 โค startTime.length โค 100
- 1 โค startTime[i] โค endTime[i] โค 1000
- 1 โค queryTime โค 1000