Skip to content

Commit 637f30e

Browse files
committed
Time: 0 ms (100%), Space: 49 MB (68.62%) - LeetHub
1 parent de29ae7 commit 637f30e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

1802-number-of-students-unable-to-eat-lunch/1802-number-of-students-unable-to-eat-lunch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var countStudents = function(students, sandwiches) {
77
let times = students.length * 4;
88
let start = 0;
99
while (times > 0) {
10+
if (students.length == 0) return 0;
1011
if (students[start] == sandwiches[start]) {
1112
students.shift();
1213
sandwiches.shift();
@@ -16,6 +17,5 @@ var countStudents = function(students, sandwiches) {
1617
}
1718
times--;
1819
}
19-
console.log(students)
2020
return students.length;
2121
};

0 commit comments

Comments
 (0)