int kthLargestElement(int n, vector<int> &nums) {
// write your code here
int num = nums.size();
sort(nums.begin(), nums.end());
return nums[num-n];
}
lintcode第5题:第K大元素
最新推荐文章于 2020-02-01 00:31:20 发布
int kthLargestElement(int n, vector<int> &nums) {
// write your code here
int num = nums.size();
sort(nums.begin(), nums.end());
return nums[num-n];
}