Solution in python using sorting
Intuition\n Describe your first thoughts on how to solve this problem. \nthe only thing that matters is the x axis, the y axis doesn\'t matter at all, so I sort
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nthe only thing that matters is the x axis, the y axis doesn\'t matter at all, so I sort the array according to the x axis, then start from the first x_value until the the last value that is less or equal to x_value + w, then you get the next value and you keep going until the last value.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(nlog(n))\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n\n# Code\n```python3 []\nclass Solution:\n    def minRectanglesToCoverPoints(self, points: List[List[int]], w: int) -> int:\n        points = sorted(points,key=lambda x: x[0])\n        res = 0\n        end = points[0][0] + w\n        for point in points:\n            if point[0] > end:\n                res += 1\n                end = point[0] + w\n        res += 1\n        return res\n\n```
['Python3']