Readable Clean Code | Runtime: 68 ms, faster than 91.03% of JavaScript online submissions
\nvar countStudents = function(students, sandwiches) {\n    var leaveToEnd = 0;\n    while (sandwiches.length > 0) {\n        if (students[0] === sandwiches[0])
```\nvar countStudents = function(students, sandwiches) {\n    var leaveToEnd = 0;\n    while (sandwiches.length > 0) {\n        if (students[0] === sandwiches[0]) {\n            sandwiches.shift();\n            students.shift();\n            leaveToEnd = 0\n        } else {\n            students.push(students.shift())\n            leaveToEnd++\n            if (leaveToEnd === students.length) {\n                break\n            }\n        }\n    }\n    return students.length\n};\n```
['JavaScript']