diff --git a/docs/notes/Leetcode 题解.md b/docs/notes/Leetcode 题解.md index 78fcf803..f60ed174 100644 --- a/docs/notes/Leetcode 题解.md +++ b/docs/notes/Leetcode 题解.md @@ -403,12 +403,10 @@ 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) { - if (buckets[i].size() <= (k - topK.size())) { - topK.addAll(buckets[i]); - } else { - topK.addAll(buckets[i].subList(0, k - topK.size())); - } + if (buckets[i].size() <= (k - topK.size())) { + topK.addAll(buckets[i]); + } else { + topK.addAll(buckets[i].subList(0, k - topK.size())); } } return topK; diff --git a/docs/notes/pics/cb5d2258-a60e-4364-94a7-3429a3064554_200.png b/docs/notes/pics/cb5d2258-a60e-4364-94a7-3429a3064554_200.png new file mode 100644 index 00000000..7a7c702d Binary files /dev/null and b/docs/notes/pics/cb5d2258-a60e-4364-94a7-3429a3064554_200.png differ diff --git a/docs/notes/算法.md b/docs/notes/算法.md index fa85797c..c7ab83c9 100644 --- a/docs/notes/算法.md +++ b/docs/notes/算法.md @@ -382,7 +382,7 @@ public class Insertion> extends Sort { 希尔排序使用插入排序对间隔 h 的序列进行排序。通过不断减小 h,最后令 h=1,就可以使得整个数组是有序的。 -

+

```java public class Shell> extends Sort { diff --git a/docs/pics/cb5d2258-a60e-4364-94a7-3429a3064554_200.png b/docs/pics/cb5d2258-a60e-4364-94a7-3429a3064554_200.png new file mode 100644 index 00000000..7a7c702d Binary files /dev/null and b/docs/pics/cb5d2258-a60e-4364-94a7-3429a3064554_200.png differ