scala solution
\nobject Solution {\n  import scala.collection.immutable.SortedSet\n  def minRectanglesToCoverPoints(points: Array[Array[Int]], w: Int): Int =\n    lazy val xs 
```\nobject Solution {\n  import scala.collection.immutable.SortedSet\n  def minRectanglesToCoverPoints(points: Array[Array[Int]], w: Int): Int =\n    lazy val xs = points.iterator.map(_.head).to(SortedSet).toList\n    xs.tail.foldLeft((1,xs.head)){case ((acc,last),next) =>\n      if(next - last <= w) (acc,last) else (acc+1, next)\n    }._1\n}\n```
['Greedy', 'Sorting', 'Scala']