Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- """
- import heapq
- def find_kth_largest(nums, k):
- return heapq.nlargest(k, nums)[-1]
- # Example usage
- nums = [3, 2, 1, 5, 6, 4]
- k = 2
- print(find_kth_largest(nums, k)) # Output: 5
Advertisement
Add Comment
Please, Sign In to add comment