Java 1ms works but not fastest
Intuition\n Describe your first thoughts on how to solve this problem. \n- Sandwiches wont need moving so no need of stack\n- Students move so we can add them t
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- Sandwiches wont need moving so no need of stack\n- Students move so we can add them to a queue and rotate if things dont match\n- if the whole queue has rotated, we return the number of students left as there is nothing more that can be done\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- Add all students to a queue\n- if the student and sandwich match, then remove student and increment sandwich counter\n- if they dont match, put the student at last of queue\n- if the whole line has moved in a circle, return the number of students as answer\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(students*sandwiches)$$\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(students)$$\n\n# Code\n```\nclass Solution {\n    public int countStudents(int[] students, int[] sandwiches) {\n        Queue<Integer> q=new LinkedList();\n        for(int s:students){\n            q.add(s);\n        }\n        for(int i=0;i<sandwiches.length;i++){\n            int shufflesLeft=q.size();\n            boolean found=false;\n            for(int j=0;j<shufflesLeft;j++){\n                int curr=q.remove();\n                if(sandwiches[i]==curr){\n                    found=true;\n                    break;\n                }else{\n                    q.add(curr);\n                }\n            }\n            if(!found){\n                return q.size();\n            }\n        }\n        return 0;\n    }\n}\n```
['Queue', 'Java']