TheAlgorithms-C/leetcode/src/215.c
2019-08-24 10:08:45 -07:00

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];
}