3111.覆盖所有点的最小矩形数目
class Solution {
public:int minRectanglesToCoverPoints(vector<vector<int>>& points, int w) {sort(points.begin(),points.end());int x=-1,t=0;for(auto &y:points){if(y[0]>x){x=y[0]+w;t++;}}return t;}
};
2418.按身高排序
char** sortPeople(char** names, int namesSize, int* heights, int heightsSize, int* returnSize) {char **a=(char **)malloc(sizeof(char*)*namesSize);int max=0,x=0,t=0;for(int i=0;i<heightsSize;i++){max=0;for(int j=0;j<heightsSize;j++){if(heights[j]>max){max=heights[j];x=j;}}heights[x]=0;a[t++]=names[x];}* returnSize=namesSize;return a;
}