From 351fb2e67cbc6c18084bedbf4abcbb17e9d7ac86 Mon Sep 17 00:00:00 2001 From: CyC2018 <1029579233@qq.com> Date: Tue, 5 Mar 2019 18:32:42 +0800 Subject: [PATCH] auto commit --- docs/notes/Leetcode 题解.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/notes/Leetcode 题解.md b/docs/notes/Leetcode 题解.md index f36e2b26..e172b7c5 100644 --- a/docs/notes/Leetcode 题解.md +++ b/docs/notes/Leetcode 题解.md @@ -403,6 +403,9 @@ public List topKFrequent(int[] nums, int k) { } List 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 {