java simple solution 100% better time
class Solution {\n\n\tpublic int countStudents(int[] students, int[] sandwiches) {\n        int zeroCount = 0, oneCount = 0;\n        for(int i : students) {\n 
class Solution {\n\n\tpublic int countStudents(int[] students, int[] sandwiches) {\n        int zeroCount = 0, oneCount = 0;\n        for(int i : students) {\n            if(i == 0) zeroCount ++;\n            else oneCount ++;\n        }\n        for(int s: sandwiches) {\n            if(s == 0) {\n                if(zeroCount == 0) return oneCount;\n                zeroCount --;\n            }\n            else {\n                if(oneCount == 0) return zeroCount;\n                oneCount--;\n            }\n        }\n        return 0;\n    }\n\n}
['Java']