Beats 100% - Sweep line/Greedy approach - Easy to Understand
Intuition\nSince our rectangles can have infinite height, we do not worry about y.\nWe can sort the points by x in non decreasing order.\nWe start at the first 
# Intuition\nSince our rectangles can have infinite height, we do not worry about y.\nWe can sort the points by x in non decreasing order.\nWe start at the first point, and keep a pointer of the x start of our rectangle.\nAt each iteration we check if p.x - startOfRect <= width. If not, we add a rectangle in our count, and move the start of our next rectangle to p.x\n\n# Approach\nWe start our l pointer (tracks rectangle start) at the first point.x, then iterate over each point, checking if our width is within the bounds. If not, we increment our count and start our new rectangle at our current x value. We increment once more after the end of the loop to account for the last opened rectangle that was not close.\n\n# Complexity\n- Time complexity:\nnLog(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```swift []\nclass Solution {\n    func minRectanglesToCoverPoints(_ points: [[Int]], _ w: Int) -> Int {\n        var rectCount = 0\n        var points = points\n\n        points.sort(by: {\n            $0[0] < $1[0]\n        })\n\n        var l = points[0][0]\n\n       \n\n        for p in points {\n            let x = p[0]\n\n            if x - l <= w {\n                \n                continue\n            }\n\n            rectCount += 1\n            l = x\n        }\n\n        rectCount += 1\n\n \n\n        return rectCount\n\n\n    }\n}\n```
['Swift']