Easy Solution [ JAVA ] ✅
\n# Complexity\n- Time complexity: O( n*log(n) )\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. 
\n# Complexity\n- Time complexity: O( n*log(n) )\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 {\n    public int minRectanglesToCoverPoints(int[][] points, int w) {\n        int ans = 1;\n        Arrays.sort(points, (a,b)->a[0]-b[0]);\n        int index = points[0][0];\n        for(int i=1; i<points.length; i++){\n            int elem = points[i][0];\n            if(elem-index > w) {\n                index = elem;\n                ans++;\n            }\n        }\n        return ans;\n    }\n}\n```
['Java']