본문 바로가기
IT/알고리즘

20] Leetcode 1450. Number of Students Doing Homework at a Given Time

by 깻잎쌈 2020. 7. 1.
반응형
 

Number of Students Doing Homework at a Given Time - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

고대로 해주면 된다.

class Solution {
public:
    int busyStudent(vector<int>& startTime, vector<int>& endTime, int queryTime) {
        int ans =0;
        for(int i = 0;i<startTime.size();i++)
            if(startTime[i]<= queryTime && endTime[i]>= queryTime)
                ans++;
        
        return ans;
            
    }
};
반응형

댓글