Just Sort and Simulate  | C++
Complexity\n- Time complexity : O(NlogN)\n\n-  Space complexity: O(1)\n\n# Code\n\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vector<i
# Complexity\n- $$Time complexity : O(NlogN)$$\n\n- $$ Space complexity: O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n    int minRectanglesToCoverPoints(vector<vector<int>> &Points, int Dist){\n        int n = Points.size() , Rectangles = 0;\n        sort(Points.begin(),Points.end());\n        for(int x1 = 0 , x2 = 0 ; x2 < n ; x2++){\n            if(Points[x2][0] - Points[x1][0] > Dist){\n                x1 = x2;\n                Rectangles++;\n            }\n        }\n        return 1 + Rectangles;\n    }\n};\n```
['C++']