阅读 85

LeetCode 分类刷题 —— Sort

Sort 的 Tips:

  • 深刻的理解多路快排。第 75 题。
  • 链表的排序,插入排序(第 147 题)和归并排序(第 148 题)
  • 桶排序和基数排序。第 164 题。
  • "摆动排序"。第 324 题。
  • 两两不相邻的排序。第 767 题,第 1054 题。
  • "饼子排序"。第 969 题。
Title Solution Difficulty Time Space 收藏
56. Merge Intervals Go Medium O(n log n) O(log n)
57. Insert Interval Go Hard O(n) O(1)
75. Sort Colors Go Medium O(n) O(1) ❤️
147. Insertion Sort List Go Medium O(n) O(1) ❤️
148. Sort List Go Medium O(n log n) O(log n) ❤️
164. Maximum Gap Go Hard O(n log n) O(log n) ❤️
179. Largest Number Go Medium O(n log n) O(log n) ❤️
220. Contains Duplicate III Go Medium O(n^2) O(1)
242. Valid Anagram Go Easy O(n) O(n)
274. H-Index Go Medium O(n) O(n)
324. Wiggle Sort II Go Medium O(n) O(n) ❤️
349. Intersection of Two Arrays Go Easy O(n) O(n)
350. Intersection of Two Arrays II Go Easy O(n) O(n)
524. Longest Word in Dictionary through Deleting Go Medium O(n) O(1)
767. Reorganize String Go Medium O(n log n) O(log n) ❤️
853. Car Fleet Go Medium O(n log n) O(log n)
710. Random Pick with Blacklist Go Hard O(n) O(n)
922. Sort Array By Parity II Go Easy O(n) O(1)
969. Pancake Sorting Go Medium O(n log n) O(log n) ❤️
973. K Closest Points to Origin Go Medium O(n log n) O(log n)
976. Largest Perimeter Triangle Go Easy O(n log n) O(log n)
1030. Matrix Cells in Distance Order Go Easy O(n^2) O(1)
1054. Distant Barcodes Go Medium O(n log n) O(log n)
关注下面的标签,发现更多相似文章
评论