92ms Concise C++ Solution


  • 0
    F
        int findMinArrowShots(vector<pair<int, int>>& points) {
            sort(points.begin(), points.end(), [](const pair<int,int>&a, const pair<int,int>& b) {
                return a.second == b.second ? a.first < b.first : a.second < b.second;
            });
            int i = 0, x = 0, curr = 0, n = points.size();
            while ((curr = i++) < n && ++x) while(i < n && points[curr].second >= points[i].first) i++;
            return x;
        }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.