qsort C++ VS2013 leetcode

时间:2021-07-01 15:26:56
class Solution {
private:
static int compare(const void * a, const void * b)
{
return (*(int*)a - *(int*)b);
} public:
int majorityElement(vector<int>& nums) {
qsort(&nums[], nums.size(), sizeof(int), &Solution::compare);
return nums[nums.size() / ];
}
};