Python Queue Simplest Solution With Explanation | Beg to adv | Queue
python\nclass Solution:\n    def countStudents(self, students: List[int], sandwiches: List[int]) -> int:\n        students = deque(students) # making provided l
```python\nclass Solution:\n    def countStudents(self, students: List[int], sandwiches: List[int]) -> int:\n        students = deque(students) # making provided list as queue for performing operation. \n        sandwhiches = deque(sandwiches) # making provided list as queue for performing operation. \n        count = 0 # taking a counter to count uneaten students. \n        while count < len(students): # counter(uneaten) should always be less then total student.  \n            if students[0] == sandwhiches[0]: # if yes, then remove the element from both the queue. \n                sandwhiches.popleft() # removing element from sandwiches queue.\n                count = 0 # making counter zero as student took the sandwiches provided. \n            else:\n                students.append(students[0]) # if students dont take the sandwich, then its getting at the end of the queue(student queue).\n                count += 1 # \n            students.popleft() # there are two uses of it. 1) Once student take the sandwich and leave 2) When student dont take the sandwich and we move them to last of the queue.\n        return len(students) # this will give us the total student how didnt eat.\n```\n\n***Found helpful, Do upvote !!***
['Queue', 'Python', 'Python3']