Sort points by x-axis and track rectangles required
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```csharp []
public class Solution {
    public int MinRectanglesToCoverPoints(int[][] points, int w) {
        HashSet<int> xIds = new();
        foreach(int[] p in points)
        {
            xIds.Add(p[0]);
        }

        int distLen = xIds.Count;

        if(w == 0)
            return distLen;

        int[] ordered = xIds.ToArray();
        Array.Sort(ordered);
        int res = 1, start = 0;

        for(int i = 1; i < distLen; i++)
        {
            if(ordered[i]-ordered[start] > w)
            {
                res++;
                start = i;
            }
        }

        return res;
    }
}
```
['C#']