auto commit

This commit is contained in:
CyC2018 2019-03-05 18:32:42 +08:00
parent c6cfc0a1cb
commit 351fb2e67c

View File

@ -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 {