typedef struct node{
int left;
int right;
}bounds;
int cmp(const void* a,const void* b){
bounds* x=(bounds*)a;
bounds* y=(bounds*)b;
if(x->right >y->right) return 1;
return -1;
}
int findMinArrowShots(int** points, int pointsSize, int* pointsColSize){
*pointsColSize=2;
bounds* b=(bounds*)malloc(sizeof(bounds)*pointsSize);
for(int i=0;i<pointsSize;i++){
b[i].left=points[i][0];
b[i].right=points[i][1];
}
qsort(b,pointsSize,sizeof(bounds),cmp);
int sum=0;
long min=LONG_MIN;
for(int i=0;i<pointsSize;i++){
long t=b[i].left;
if(t>min){
sum++;
min=b[i].right;
}
}
return sum;
}
标签:right,return,int,452,bounds,pointsColSize,引爆,气球
From: https://www.cnblogs.com/llllmz/p/18078630