100% Beats in Java || Easy to Understand || Very Easy Solution
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:O(nLogn)\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 ret = 0;\n        Arrays.sort(points, (A, B) -> A[0] - B[0]);\n        int startX = points[0][0];\n\n        for(int[] point : points) {\n            if(point[0] - startX > w) {\n                ret++;\n                startX = point[0];\n            }\n        }\n\n        return ret + 1;\n    }\n}\n```
['Java']