✅95.55%🔥||✅Simple Python Solution||🔥Easy to understand||✅Beginner Friendly
Approach:\nUse the stack data structure with the students. If the sandwich does not match, append to the end. Do this until all students have seen the same sand
**Approach:**\nUse the stack data structure with the students. If the sandwich does not match, append to the end. Do this until all students have seen the same sandwich.\nReturn the sandwiches that are left -> rest.\n\n---\n**Complexity:**\n\n* Time complexity: O(n)\n\n* Space complexity: O(n)\n\n---\n**Code:**\n```\nclass Solution:\n    def countStudents(self, students: List[int], sandwiches: List[int]) -> int:\n        c = 0\n        \n        while c < 2*len(students):\n            if sandwiches[0] == students[0]:\n                sandwiches.pop(0)\n                students.pop(0)\n                c = 0\n            else:\n                students.append(students.pop(0))\n            \n            c += 1\n        return len(sandwiches)\n```\n\n---\nIf you have any suggestions, let me know!\nThank you and **upvote** if you got any help!!\n\n---
['Stack', 'Python', 'Python3']