class Solution {
public:
/*
* param k : description of k
* param nums : description of array and index 0 ~ n-1
* return: description of return
*/
int kthLargestElement(int k,vector<int> nums) {
// write your code here
sort(nums.begin(),nums.end());
return nums[nums.size()-k];
}
};
LintCode-剑指Offer-(5)第k大元素
最新推荐文章于 2019-02-27 11:09:12 发布