Funny solution to share (Easy understanding)
Intuition\n Describe your first thoughts on how to solve this problem. \nWhen a student does not get what they prefer, append them to the end of list so they ge
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWhen a student does not get what they prefer, append them to the end of list so they get back to queue.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTreat the list as a queue, when a student does not get what they want, append to the end of list. \n1. Initialize i = 0 and j = 0, i indicates the pointer to the start of the students list and j is the pointer to the start of the sandwiches list. \n2. Initialize eat = 0 to keep track of how many sandwiches been eaten. \n3. loop through the sandwiches list, if students[i] prefer  sandwiches[j], increment j by 1, means move to the next sandwiches, and increment i by 1, means move to the next student. increment eat by 1.\n4. if student[i] does not prefer sandwich[j], move the students to the end of the list (queue again). increment i by 1 move to the next student. \n5. Lastly, if student has returned to the list for 5 times, break and end as they probably not gonna get the sandwiches they prefer anymore. Why 5? I don\'t know either. Also I post this solution because I found this funny. \n6. Lastly, return the number of students minus eat, so the remaining are the number of students that did not get a chance to eat a sandwich\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def countStudents(self, students: List[int], sandwiches: List[int]) -> int:\n        n = len(students)\n        i = 0\n        j = 0\n        eat = 0\n        while j < len(sandwiches):\n            if students[i] == sandwiches[j]:\n                eat += 1\n                i += 1\n                j += 1\n            else:\n                num = students[i]\n                students.append(num)\n                i += 1\n                if (i > 5 * n):\n                    break\n\n        return n - eat\n\n```
['Python3']