Top k Largest Numbers
Problem
- source(lintcode): https://www.lintcode.com/problem/top-k-largest-numbers/
Description
Given an integer array, find the top k largest numbers in it.
Example
Given [3,10,1000,-99,4,100]
and k = 3
. Return [1000, 100, 10]
.
题解
简单题,使用堆即可。
Java
1 | public class Solution { |
源码分析
略
复杂度分析
略
Top k Largest Numbers