Easy C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\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        if(points.size() == 1) return 1;\n        sort(points.begin(), points.end());\n        int cnt = 0;\n        int prev = points[0][0]; \n        for(int i=1;i<points.size();i++) {\n            if(i == points.size()-1) {\n                if(points[i][0] - prev > w) {\n                    cnt+=2;\n                } else {\n                    cnt++;\n                }\n            } else {\n                if(points[i][0] - prev > w) {\n                    cnt++;\n                    prev = points[i][0];\n                } \n            }\n        }\n        return cnt;\n    }\n};\n```
['C++']