[C] Sorting
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(nlogn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n\n/*\n * 3111. Minimum Rectangles to Cover Points\n *\n * You are given a 2D integer array points, where points[i] = [xi, yi]. \n * You are also given an integer w. Your task is to cover all the given \n * points with rectangles.\n *\n * Each rectangle has its lower end at some point (x1, 0) and its upper end \n * at some point (x2, y2), where x1 <= x2, y2 >= 0, and the condition x2 - x1 \n * <= w must be satisfied for each rectangle.\n *\n * A point is considered covered by a rectangle if it lies within or on the \n * boundary of the rectangle.\n *\n * Return an integer denoting the minimum number of rectangles needed so that \n * each point is covered by at least one rectangle.\n *\n * Note: A point may be covered by more than one rectangle.\n *\n * 1 <= points.length <= 10^5\n * points[i].length == 2\n * 0 <= xi == points[i][0] <= 10^9\n * 0 <= yi == points[i][1] <= 10^9\n * 0 <= w <= 10^9\n * All pairs (xi, yi) are distinct.\n */\n\nint cmp(const void *a, const void *b)\n{\n    return (*((int **)a))[0] - (*((int **)b))[0];\n}\n\nint minRectanglesToCoverPoints(int** points, int pointsSize, int* pointsColSize, int w) {\n\n    /*\n     * Input:\n     *  **points, \n     *  pointsSize, \n     *  *pointsColSize, \n     *  w\n     */\n\n    int ans = 1;\n\n    /* Sort by x in ascending order */\n    qsort(points, pointsSize, sizeof(int *), cmp);\n\n    /* Generate bar and check the coverage */\n    for (int i = 0, bar = points[i][0] + w; i < pointsSize; i++) {\n        if (points[i][0] > bar) {\n            ans++;\n            bar = points[i][0] + w;\n        }\n    }\n\n    /*\n     * Output:\n     *  Return an integer denoting the minimum number of rectangles needed so that \n     *  each point is covered by at least one rectangle.\n     */\n\n    return ans;\n}\n```
['Array', 'Greedy', 'C', 'Sorting']