2089. 找出数组排序后的目标下标
2089. 找出数组排序后的目标下标
思路:
1.定义返回的数组
2.用qsort函数排序
3.找目标,把下标存进去
4.返回数组长度
5.返回结果
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int cmp(const void*a,const void*b){
return *(int*)a-*(int*)b; //比较函数
}
i
原创
2021-12-30 14:29:31 ·
595 阅读 ·
0 评论