int cmp_up(void *a, void *b) { return *(int *)a - *(int *)b; } int majorityElement(int *nums, int numsSize) { qsort(nums, numsSize, sizeof(int), cmp_up); return nums[numsSize / 2]; }
int cmp_up(void *a, void *b) { return *(int *)a - *(int *)b; } int majorityElement(int *nums, int numsSize) { qsort(nums, numsSize, sizeof(int), cmp_up); return nums[numsSize / 2]; }