Python | Easy
see the Successfully Accepted Submission\n\n# Code\n\nfrom collections import deque\nfrom typing import List\n\nclass Solution:\n    def countStudents(self, stu
[see the Successfully Accepted Submission](https://leetcode.com/problems/number-of-students-unable-to-eat-lunch/submissions/1226405552/?envType=daily-question&envId=2024-04-08)\n\n# Code\n```\nfrom collections import deque\nfrom typing import List\n\nclass Solution:\n    def countStudents(self, students: List[int], sandwiches: List[int]) -> int:\n        circular_students = deque()\n        square_students = deque()\n        \n        # Separate students based on their sandwich preference\n        for i, pref in enumerate(students):\n            if pref == 0:\n                circular_students.append(i)\n            else:\n                square_students.append(i)\n        \n        # Iterate through the sandwiches\n        for sandwich in sandwiches:\n            if sandwich == 0:\n                if circular_students:\n                    circular_students.popleft()\n                else:\n                    break\n            else:\n                if square_students:\n                    square_students.popleft()\n                else:\n                    break\n        \n        # Return the number of students unable to eat\n        return len(circular_students) + len(square_students)\n\n```\n![image](https://assets.leetcode.com/users/images/b1e4af48-4da1-486c-bc97-b11ae02febd0_1696186577.992237.jpeg)
['Python3']