JAVA - 3 ms Simple Solution - Insertion & Deletion w/ ArrayList
\nclass Solution {\n    public int countStudents(int[] students, int[] sandwiches) {\n        ArrayList<Integer> st = new ArrayList<Integer>();\n        ArrayLi
```\nclass Solution {\n    public int countStudents(int[] students, int[] sandwiches) {\n        ArrayList<Integer> st = new ArrayList<Integer>();\n        ArrayList<Integer> sa = new ArrayList<Integer>();\n        for (int i : students) st.add(i);\n        for (int i : sandwiches) sa.add(i);\n        int c = 0;\n        while (sa.size() > 0)\n        {\n            if (st.get(0) == sa.get(0)) \n            {\n                sa.remove(0);\n                st.remove(0);\n                c = 0;\n            }\n            else\n            {\n                st.add(st.get(0));\n                st.remove(0);\n                c++;\n                if (c == st.size()) return c;\n            }\n        }\n        return 0;\n    }\n}\n```\nFirst, create ArrayLists for both arrays.\nIf the first element of both lists is same, the person eats the sandwich and so we delete the first element of both. We also reset the value of c.\nIf the first element of both is different, we increment our counter c.\nc tracks the number of people who consecutively skip the sandwich and go to the end ("hunger streak"). If all the ppl do this, then we will return c.
['Java']