3111. Minimum Rectangles to Cover Points
You are given a 2D integer array
points
, wherepoints[i] = [xi, yi]
. You are also given an integerw
. Your task is to cover all the given points with rectangles.Each rectangle has its lower end at some point
(x1, 0)
and its upper end at some point(x2, y2)
, wherex1 <= x2
,y2 >= 0
, and the conditionx2 - x1 <= w
must be satisfied for each rectangle.A point is considered covered by a rectangle if it lies within or on the boundary of the rectangle.
Return an integer denoting the minimum number of rectangles needed so that each point is covered by at least one rectangle.
Note: A point may be covered by more than one rectangle.
1 | class Solution { |