Kotlin TreeSet solution
Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(n)\n\n# Code\n\nclass Solution {\n    fun minRectanglesToCoverPoints(points: Array<IntArray>,
# Complexity\n- Time complexity:\n$$O(nlogn)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```\nclass Solution {\n    fun minRectanglesToCoverPoints(points: Array<IntArray>, w: Int): Int {\n        val ts = TreeSet(points.map { it[0] })\n        var ans = 0\n        var curr = ts.firstOrNull()\n        while (curr != null) {\n            ans++\n            curr = ts.higher(curr + w)\n        }\n        return ans\n    }\n}\n```
['Kotlin']