[C++] Sort
Code\n\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vector<int>>& points, int w) {\n        int n = points.size(), i = 0, j = 0, ans = 
# Code\n```\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vector<int>>& points, int w) {\n        int n = points.size(), i = 0, j = 0, ans = 0;\n        sort(points.begin(), points.end());\n        while (i < n)\n        {\n            j = i;\n            while (j < n && points[j][0] - points[i][0] <= w)\n                j++;\n            ans++;\n            i = j;\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'Sorting', 'C++']