Swift || Sort + Two Pointers
Code\n\nclass Solution {\n    func minRectanglesToCoverPoints(_ points: [[Int]], _ w: Int) -> Int {\n        let points = points.sorted { $0[0] < $1[0] }\n     
# Code\n```\nclass Solution {\n    func minRectanglesToCoverPoints(_ points: [[Int]], _ w: Int) -> Int {\n        let points = points.sorted { $0[0] < $1[0] }\n        var total = 1\n        var left = 0\n\n        for right in 0..<points.count {\n            let x = points[right][0]\n            let previousX = points[left][0]\n\n           if x-previousX > w {\n                left = right\n                total += 1 \n           }\n        }\n\n        return total\n    }\n}\n\n```
['Swift']