알고리즘
K th largest element in an Array
e-pd
2020. 8. 25. 12:36
https://leetcode.com/problems/kth-largest-element-in-an-array/submissions/
Kth Largest Element in an Array - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
1
2
3
4
5
6
|
class Solution {
public int findKthLargest(int[] nums, int k) {
Arrays.sort(nums);
return nums[nums.length - k];
}
}
|
cs |