Skip to content

Commit 9f4dcdd

Browse files
authored
Update 1094. Car Pooling
1 parent 6cde5e4 commit 9f4dcdd

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎leetcode3/정진영/1094. Car Pooling‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ var carPooling = function(trips, capacity) {
1212
let from = trips[i][1];
1313
let to = trips[i][2];
1414

15-
arr[from] += np;
16-
arr[to] -= np;
15+
arr[from] += nP;
16+
arr[to] -= nP;
1717
}
1818

19-
if (capacity)
19+
let count = 0;
20+
for (let j = 0; j < arr.length; j++){
21+
count += arr[j];
22+
if (count > capacity) {
23+
return false;
24+
}
25+
}
26+
return true;
2027
};

0 commit comments

Comments
 (0)