mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
9 lines
206 B
C
9 lines
206 B
C
int *cmpval (const void *a, const void *b) {
|
|
return *(int *)b - *(int *)a;
|
|
}
|
|
|
|
int findKthLargest(int* nums, int numsSize, int k){
|
|
qsort(nums, numsSize, sizeof(int), cmpval);
|
|
return nums[k-1];
|
|
}
|