LovePinkLol-Python Programming
Tuesday, November 28, 2017
215. Kth Largest Element in an Array
import heapq
class Solution:
def findKthLargest(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
new_list = heapq.nlargest(k,nums)
return new_list.pop()
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment