c++ solution
\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vector<int>>& points, int w) {\n        int n=points.size();\n        map<int,int>mp;\n  
```\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vector<int>>& points, int w) {\n        int n=points.size();\n        map<int,int>mp;\n        for(auto &point:points){\n            mp[point[0]]++;\n        }\n        int counter=1;\n        auto iter=mp.begin();\n        int previous = iter->first;\n        while(iter!=mp.end()){\n            if(iter->first-previous>w){\n                counter++;\n                previous=iter->first;\n            }\n            iter++;\n        }\n        return counter;\n    }\n};\n```
['C', 'Sorting', 'C++']