Skip to content

Commit d357e4a

Browse files
committed
Runtime: 280 ms (Top 87.39%) | Memory: 56.3 MB (Top 66.94%)
1 parent d0f7747 commit d357e4a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 280 ms (Top 87.39%) | Memory: 56.3 MB (Top 66.94%)
12
class Solution {
23
public:
34
bool static cmp(vector<int> &a,vector<int>&b) {
@@ -8,14 +9,14 @@ class Solution {
89
int sm = 0;
910
priority_queue<int> pq;
1011
for(int i=0; i<courses.size(); i++) {
11-
pq.push(courses[i][0]);
12+
pq.push(courses[i][0]);
1213
sm+=courses[i][0]; // sum of duration of courses
1314
// when there exists a course duration that is invalid and can't be completed on that day!
14-
if(sm>courses[i][1]) {
15-
sm-=pq.top(); // remove the biggest invalid course duration!
15+
if(sm>courses[i][1]) {
16+
sm-=pq.top(); // remove the biggest invalid course duration!
1617
pq.pop();
1718
}
1819
}
1920
return pq.size();
2021
}
21-
};
22+
};

0 commit comments

Comments
 (0)