Optimised O(NlogN) Easy Solution
\n# Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vect
\n# Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vector<int>>& points, int w) {\n        sort(points.begin(),points.end());\n        int c=0,cnt=0;\n        for(auto i=1;i<points.size();i++)\n        {\n            c+=points[i][0]-points[i-1][0];\n            if(c>w)\n            {\n                cnt++;\n                c=0;\n            }\n        }\n        cnt++;\n        return cnt;\n    }\n};\n```
['C++']