← 返回 meta 的题目列表Find K Largest Numbers Using Heap
类型:online_judge
Given an integer array nums and an integer k, find the k largest numbers in the array and return them as a list. Implement your solution using a heap data structure. The input size can be up to 10^5. Example:
Input: nums = [3, 1, 5, 12, 2, 11], k = 3
Output: [12, 11, 5]
Example
Input
3 1 5 12 2 11
3