题目:原题链接(中等)
标签:堆
解法 | 时间复杂度 | 空间复杂度 | 执行用时 |
Ans 1 (Python) | O ( N + K ) | O ( N ) | 44ms (83.17%) |
Ans 2 (Python) | |||
Ans 3 (Python) |
解法一:
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
return heapq.nlargest(k, nums)[-1]
LeetCode题解(0215):数组中的第K个最大元素(Python)
阅读 162
2022-02-23
题目:原题链接(中等)
标签:堆
解法 | 时间复杂度 | 空间复杂度 | 执行用时 |
Ans 1 (Python) | O ( N + K ) | O ( N ) | 44ms (83.17%) |
Ans 2 (Python) | |||
Ans 3 (Python) |
解法一:
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
return heapq.nlargest(k, nums)[-1]
相关推荐
精彩评论(0)