ps | |
---|---|
링크 | leetcode.com/… |
출처 | LeetCode |
문제 번호 | 215 |
문제명 | Kth Largest Element in an Array |
레벨 | Medium |
분류 |
선택 알고리즘 |
시간복잡도 | O(n) |
인풋사이즈 | n<=??? |
사용한 언어 | Python |
해결날짜 | 2020/12/20 |
"""Solution code for "LeetCode 215. Kth Largest Element in an Array".
- Problem link: https://leetcode.com/problems/kth-largest-element-in-an-array/
- Solution link: http://www.teferi.net/ps/problems/leetcode/215
"""
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
return sorted(nums)[-k]