✅ C++Solution  ✅ || Sorting  || Two Pointer
Approach\n Describe your approach to solving the problem. \nUses Two pointer approach\n\n# Complexity\n- Time complexity: O(N*logN)\n Add your time complexity h
# Approach\n<!-- Describe your approach to solving the problem. -->\nUses Two pointer approach\n\n# Complexity\n- Time complexity: O(N*logN)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vector<int>>& points, int w) {\n\n        int n = points.size();\n        if (n == 1)\n            return 1;\n\n        sort(points.begin(), points.end());\n\n        int l = 0;\n        int r = 1;\n        int ans = 0;\n\n        while (r < n) {\n\n            while (r < n && points[r][0] - points[l][0] <= w) {\n                r++;\n            }\n\n            l = r;\n            r++;\n\n            ans++;\n        }\n\n        if (l == n - 1)\n            ans++;\n\n        return ans;\n    }\n};\n```
['Two Pointers', 'Sorting', 'C++']