qsort C++ VS2013 leetcode
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[0], nums.size(), sizeof(int), &Solution::compare); return nums[nums.size() / 2]; } };