提交 351fb2e6 编写于 作者: C CyC2018

auto commit

上级 c6cfc0a1
......@@ -403,6 +403,9 @@ public List<Integer> topKFrequent(int[] nums, int k) {
}
List<Integer> topK = new ArrayList<>();
for (int i = buckets.length - 1; i >= 0 && topK.size() < k; i--) {
if (buckets[i] == null) {
continue;
}
if (buckets[i].size() <= (k - topK.size())) {
topK.addAll(buckets[i]);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册