Number of Students Doing Homework at a Given Time

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.
I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.
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.
LeetCode Problem: Link | Click Here
class Solution {
public int busyStudent(int[] startTime, int[] endTime, int queryTime) {
// Get the length of the start time array
int startTimeLength = startTime.length;
// Initialize the output variable to count busy students
int output = 0;
// Iterate through the start time array
for (int i = 0; i < startTimeLength; i++) {
// Iterate from start time to end time for each student
for (int j = startTime[i]; j <= endTime[i]; j++) {
// Check if the current time matches the query time
if (j == queryTime) {
// Increment the output count as student is busy at query time
output++;
}
}
}
// Return the total count of students busy at the query time
return output;
}
}




