text: int cmp(const void *a, const void *b)
  {
      return *(int*)a - *(int*)b;
  }
  
  int majorityElement(int* nums, int numsSize)
  {
      qsort(nums, numsSize, sizeof(int), cmp);
      int cur = 1;
      for (int i = 1;i < numsSize; i++) {
          if (nums[i] == nums[i - 1])
              cur++;
          else if (cur > numsSize / 2)
                  return nums[i-1];
          else
              cur = 1;
      }
      return nums[numsSize - 1];
  }
  