Easy and striaght-forward solution
\n# Code\n\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vector<int>>& points, int w) {\n        sort(points.begin(),points.end());\n   
\n# Code\n```\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vector<int>>& points, int w) {\n        sort(points.begin(),points.end());\n        int t=points[0][0],ans=1;\n        for(int i=1;i<points.size();i++)\n        {\n            if(points[i][0]-t<=w)\n            {\n                continue;\n            }\n            else{\n                t=points[i][0];\n                ans++;\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']