TypeScript One Liner
IntuitionSince there is no extra condition we can start assigning rectangles from the first point.Approach
Sort the points in non decreasing order of X coordina
# Intuition
Since there is no extra condition we can start assigning rectangles from the first point.

# Approach
1. Sort the points in non decreasing order of X coordinates
2. Start a loop from the first index and mark the maximum X coordinate a rectangle would span by adding `w` to its X coordinate
3. If a point which is more than previously marked value appears it means that the previous rectangle would not cover this point. Increment the number of rectangles and mark the maximum X coordinate again.

# Complexity
- Time complexity:
$$O(nlog(n)) + O(n)$$ - For sorting and then looping through the array

- Space complexity:
$$O(n)$$ - For storing the new array formed of only X coordinates

# Code
```typescript []
function minRectanglesToCoverPoints(points: number[][], w: number): number {
  return points
    .map(([xCoordinate]) => xCoordinate)
    .sort((aXc, bXc) => aXc - bXc)
    .reduce(
      ([maxXc, numOfRectangles], xC) => {
        return xC <= maxXc
          ? [maxXc, numOfRectangles]
          : [xC + w, numOfRectangles + 1];
      },
      [-1, 0],
    )[1];
}
```
['Array', 'Greedy', 'Sorting', 'TypeScript']