Skip to content

Commit

Permalink
Time: 802 ms (50.98%), Space: 89.7 MB (93.84%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipendra-Raghav committed Jan 5, 2023
1 parent 097870f commit 81e6093
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Solution {
public:
int findMinArrowShots(vector<vector<int>>& points) {
sort(points.begin(),points.end());
int k=points[0][1];
int cnt=0;
for(int i=1;i<points.size();i++)
{
if(points[i][0]<=k)
{
k=min(k,points[i][1]);
continue;
}
else
{
cnt++;
k=points[i][1];
}
}
return cnt+1;

}
};

0 comments on commit 81e6093

Please sign in to comment.