One too many dimensions
Intuition\nFirst, we notice there are no restrictions on the height of the rectangles, and we only need the minimum amount of rectangles that will match all poi
# Intuition\nFirst, we notice there are no restrictions on the height of the rectangles, and we only need the minimum amount of rectangles that will match all points. Therefore we can make all our rectangles that start at `-inf` and end at `+inf` -- effectively disregarding the Y component of each Point.\n\n# Approach\nSince Y components are disregarded, we can store the Xs in a `List<int>` and `Sort` it.\nAfterwards, we\'re sure the minimum point needs to be contained in the rect, and there\'s no need (ever) to make a rectangle with width smaller than `w`. Thus, we keep making rectangles of size `(w, inf)` until there are no points left uncovered!\n\n# Code\n```csharp []\npublic class Solution {\n    static List<int> ppoints = new();\n    public int MinRectanglesToCoverPoints(int[][] points, int w) {\n        ppoints.Clear();\n        for (int i = 0; i < points.Length; i++) { ppoints.Add(points[i][0]); }\n        if (w == 0) { return ppoints.Distinct().Count(); }\n        ppoints.Sort();\n\n        int totalRects = 0;\n        while (ppoints.Count > 0) {\n            var minX = ppoints[0];\n            var maxX = minX + w;\n\n            int totalMatches = 1;\n            for (; totalMatches < ppoints.Count; totalMatches++) {\n                if (ppoints[totalMatches] > maxX) { break; }\n            }\n            ppoints.RemoveRange(0, totalMatches);\n            totalRects++;\n        }\n\n        return totalRects;\n    }\n}\n```
['C#']