Simple java solution
Complexity\n- Time complexity: O(n logn)\n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution {\n    public int minRectanglesToCoverPoints(int[][] points, in
# Complexity\n- Time complexity: $$O(n logn)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\n    public int minRectanglesToCoverPoints(int[][] points, int w) {\n        Arrays.sort(points, (a,b) -> a[0]-b[0]);\n        int count=0;\n        for(int i=0;i<points.length;i++)\n        {\n            int j=i;\n            while((j < points.length) && (points[j][0] - points[i][0] <= w) && (points[i][1] >= 0))\n            {\n                j++;\n            }\n            count++;\n            i=j-1;\n        }\n        return count;\n    }\n}\n```
['Java']