Skip to content

Commit 644bf31

Browse files
committed
Time: 1193 ms (12.24%), Space: 102.3 MB (8.96%) - LeetHub
1 parent 527b605 commit 644bf31

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Solution {
2+
public:
3+
int findMinArrowShots(vector<vector<int>>& p) {
4+
5+
sort(p.begin(), p.end());
6+
int lastpoint = p[0][1];
7+
int ans = 1;
8+
for(auto point : p) {
9+
if(point[0] > lastpoint) {
10+
ans++;
11+
lastpoint = point[1];
12+
}
13+
lastpoint = min(point[1],lastpoint);
14+
}
15+
return ans;
16+
17+
}
18+
};

0 commit comments

Comments
 (0)