Leetcode Note: Go - Number of Students Doing Homework at a Given Time

Number of Students Doing Homework at a Given Time - LeetCode
https://leetcode.com/problems/number-of-students-doing-homework-at-a-given-time/

  • Go 言語で取り組んだメモ

回答

golang Solution - Number of Students Doing Homework at a Given Time - LeetCode
https://leetcode.com/problems/number-of-students-doing-homework-at-a-given-time/solutions/693649/golang-solution/

func busyStudent(startTime []int, endTime []int, queryTime int) int {
    res := 0
    for i := 0; i < len(startTime); i++ {
        if queryTime <= endTime[i] && queryTime >= startTime[i] {
            res++
        }
    }
    
    return res
}