1700. Number of Students Unable to Eat Lunch

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1700

class Solution:
    def countStudents(self, students: List[int], sandwiches: List[int]) -> int:
        cnt = Counter(students)
        for v in sandwiches:
            if cnt[v] == 0:
                return cnt[v ^ 1]
            cnt[v] -= 1
        return 0