bool comp(vector<int>&x, vector<int>&y) //Custom comparator { return x[1]<y[1]; } class Solution { public: int findMinArrowShots(vector<vector<int>>& points) { int n=points.size(); if(n==0) return 0; if(n==1) return 1; sort(points.begin(),points.end(), comp); int prev=points[0][1]; int no_ballon=1; for(int i=1;i<n;i++) { if(points[i][0]<=prev) continue; prev=points[i][1]; no_ballon++; } return no_ballon; } };