Files
2021-11-06 19:06:10 -07:00

14 KiB
Executable File

title type weight
2.14 Sorting docs 14

Sorting

  • 深刻的理解多路快排。第 75 题。
  • 链表的排序,插入排序(第 147 题)和归并排序(第 148 题)
  • 桶排序和基数排序。第 164 题。
  • "摆动排序"。第 324 题。
  • 两两不相邻的排序。第 767 题,第 1054 题。
  • "饼子排序"。第 969 题。
No. Title Solution Difficulty TimeComplexity SpaceComplexity Favorite Acceptance
0015 3Sum [Go]({{< relref "/ChapterFour/0001~0099/0015.3Sum.md" >}}) Medium 29.9%
0016 3Sum Closest [Go]({{< relref "/ChapterFour/0001~0099/0016.3Sum-Closest.md" >}}) Medium 46.9%
0018 4Sum [Go]({{< relref "/ChapterFour/0001~0099/0018.4Sum.md" >}}) Medium 36.7%
0049 Group Anagrams [Go]({{< relref "/ChapterFour/0001~0099/0049.Group-Anagrams.md" >}}) Medium 62.4%
0056 Merge Intervals [Go]({{< relref "/ChapterFour/0001~0099/0056.Merge-Intervals.md" >}}) Medium O(n log n) O(log n) 43.3%
0075 Sort Colors [Go]({{< relref "/ChapterFour/0001~0099/0075.Sort-Colors.md" >}}) Medium O(n) O(1) ❤️ 52.8%
0088 Merge Sorted Array [Go]({{< relref "/ChapterFour/0001~0099/0088.Merge-Sorted-Array.md" >}}) Easy 42.3%
0147 Insertion Sort List [Go]({{< relref "/ChapterFour/0100~0199/0147.Insertion-Sort-List.md" >}}) Medium O(n^2) O(1) ❤️ 46.2%
0148 Sort List [Go]({{< relref "/ChapterFour/0100~0199/0148.Sort-List.md" >}}) Medium O(n log n) O(log n) ❤️ 49.0%
0164 Maximum Gap [Go]({{< relref "/ChapterFour/0100~0199/0164.Maximum-Gap.md" >}}) Hard O(n log n) O(log n) ❤️ 40.5%
0169 Majority Element [Go]({{< relref "/ChapterFour/0100~0199/0169.Majority-Element.md" >}}) Easy 61.5%
0179 Largest Number [Go]({{< relref "/ChapterFour/0100~0199/0179.Largest-Number.md" >}}) Medium O(n log n) O(log n) ❤️ 32.0%
0215 Kth Largest Element in an Array [Go]({{< relref "/ChapterFour/0200~0299/0215.Kth-Largest-Element-in-an-Array.md" >}}) Medium 61.4%
0217 Contains Duplicate [Go]({{< relref "/ChapterFour/0200~0299/0217.Contains-Duplicate.md" >}}) Easy 59.1%
0220 Contains Duplicate III [Go]({{< relref "/ChapterFour/0200~0299/0220.Contains-Duplicate-III.md" >}}) Medium O(n log n) O(1) ❤️ 21.5%
0229 Majority Element II [Go]({{< relref "/ChapterFour/0200~0299/0229.Majority-Element-II.md" >}}) Medium 40.7%
0242 Valid Anagram [Go]({{< relref "/ChapterFour/0200~0299/0242.Valid-Anagram.md" >}}) Easy O(n) O(n) 60.2%
0268 Missing Number [Go]({{< relref "/ChapterFour/0200~0299/0268.Missing-Number.md" >}}) Easy 57.7%
0274 H-Index [Go]({{< relref "/ChapterFour/0200~0299/0274.H-Index.md" >}}) Medium O(n) O(n) 37.0%
0324 Wiggle Sort II [Go]({{< relref "/ChapterFour/0300~0399/0324.Wiggle-Sort-II.md" >}}) Medium O(n) O(n) ❤️ 31.6%
0347 Top K Frequent Elements [Go]({{< relref "/ChapterFour/0300~0399/0347.Top-K-Frequent-Elements.md" >}}) Medium 63.7%
0349 Intersection of Two Arrays [Go]({{< relref "/ChapterFour/0300~0399/0349.Intersection-of-Two-Arrays.md" >}}) Easy O(n) O(n) 67.5%
0350 Intersection of Two Arrays II [Go]({{< relref "/ChapterFour/0300~0399/0350.Intersection-of-Two-Arrays-II.md" >}}) Easy O(n) O(n) 53.8%
0354 Russian Doll Envelopes [Go]({{< relref "/ChapterFour/0300~0399/0354.Russian-Doll-Envelopes.md" >}}) Hard 39.2%
0368 Largest Divisible Subset [Go]({{< relref "/ChapterFour/0300~0399/0368.Largest-Divisible-Subset.md" >}}) Medium 39.1%
0378 Kth Smallest Element in a Sorted Matrix [Go]({{< relref "/ChapterFour/0300~0399/0378.Kth-Smallest-Element-in-a-Sorted-Matrix.md" >}}) Medium 58.5%
0389 Find the Difference [Go]({{< relref "/ChapterFour/0300~0399/0389.Find-the-Difference.md" >}}) Easy 58.8%
0414 Third Maximum Number [Go]({{< relref "/ChapterFour/0400~0499/0414.Third-Maximum-Number.md" >}}) Easy 31.1%
0435 Non-overlapping Intervals [Go]({{< relref "/ChapterFour/0400~0499/0435.Non-overlapping-Intervals.md" >}}) Medium 46.4%
0436 Find Right Interval [Go]({{< relref "/ChapterFour/0400~0499/0436.Find-Right-Interval.md" >}}) Medium 49.0%
0451 Sort Characters By Frequency [Go]({{< relref "/ChapterFour/0400~0499/0451.Sort-Characters-By-Frequency.md" >}}) Medium 66.8%
0455 Assign Cookies [Go]({{< relref "/ChapterFour/0400~0499/0455.Assign-Cookies.md" >}}) Easy 50.6%
0462 Minimum Moves to Equal Array Elements II [Go]({{< relref "/ChapterFour/0400~0499/0462.Minimum-Moves-to-Equal-Array-Elements-II.md" >}}) Medium 56.1%
0475 Heaters [Go]({{< relref "/ChapterFour/0400~0499/0475.Heaters.md" >}}) Medium 34.5%
0524 Longest Word in Dictionary through Deleting [Go]({{< relref "/ChapterFour/0500~0599/0524.Longest-Word-in-Dictionary-through-Deleting.md" >}}) Medium O(n) O(1) 50.7%
0532 K-diff Pairs in an Array [Go]({{< relref "/ChapterFour/0500~0599/0532.K-diff-Pairs-in-an-Array.md" >}}) Medium 37.0%
0561 Array Partition I [Go]({{< relref "/ChapterFour/0500~0599/0561.Array-Partition-I.md" >}}) Easy 74.8%
0581 Shortest Unsorted Continuous Subarray [Go]({{< relref "/ChapterFour/0500~0599/0581.Shortest-Unsorted-Continuous-Subarray.md" >}}) Medium 33.6%
0594 Longest Harmonious Subsequence [Go]({{< relref "/ChapterFour/0500~0599/0594.Longest-Harmonious-Subsequence.md" >}}) Easy 52.1%
0611 Valid Triangle Number [Go]({{< relref "/ChapterFour/0600~0699/0611.Valid-Triangle-Number.md" >}}) Medium 49.2%
0628 Maximum Product of Three Numbers [Go]({{< relref "/ChapterFour/0600~0699/0628.Maximum-Product-of-Three-Numbers.md" >}}) Easy 46.7%
0632 Smallest Range Covering Elements from K Lists [Go]({{< relref "/ChapterFour/0600~0699/0632.Smallest-Range-Covering-Elements-from-K-Lists.md" >}}) Hard 56.8%
0645 Set Mismatch [Go]({{< relref "/ChapterFour/0600~0699/0645.Set-Mismatch.md" >}}) Easy 41.1%
0658 Find K Closest Elements [Go]({{< relref "/ChapterFour/0600~0699/0658.Find-K-Closest-Elements.md" >}}) Medium 43.8%
0692 Top K Frequent Words [Go]({{< relref "/ChapterFour/0600~0699/0692.Top-K-Frequent-Words.md" >}}) Medium 53.9%
0710 Random Pick with Blacklist [Go]({{< relref "/ChapterFour/0700~0799/0710.Random-Pick-with-Blacklist.md" >}}) Hard O(n) O(n) 33.1%
0719 Find K-th Smallest Pair Distance [Go]({{< relref "/ChapterFour/0700~0799/0719.Find-K-th-Smallest-Pair-Distance.md" >}}) Hard 33.8%
0720 Longest Word in Dictionary [Go]({{< relref "/ChapterFour/0700~0799/0720.Longest-Word-in-Dictionary.md" >}}) Medium 50.3%
0767 Reorganize String [Go]({{< relref "/ChapterFour/0700~0799/0767.Reorganize-String.md" >}}) Medium O(n log n) O(log n) ❤️ 51.2%
0791 Custom Sort String [Go]({{< relref "/ChapterFour/0700~0799/0791.Custom-Sort-String.md" >}}) Medium 67.6%
0792 Number of Matching Subsequences [Go]({{< relref "/ChapterFour/0700~0799/0792.Number-of-Matching-Subsequences.md" >}}) Medium 49.8%
0826 Most Profit Assigning Work [Go]({{< relref "/ChapterFour/0800~0899/0826.Most-Profit-Assigning-Work.md" >}}) Medium 40.4%
0853 Car Fleet [Go]({{< relref "/ChapterFour/0800~0899/0853.Car-Fleet.md" >}}) Medium O(n log n) O(log n) 46.9%
0869 Reordered Power of 2 [Go]({{< relref "/ChapterFour/0800~0899/0869.Reordered-Power-of-2.md" >}}) Medium 61.3%
0870 Advantage Shuffle [Go]({{< relref "/ChapterFour/0800~0899/0870.Advantage-Shuffle.md" >}}) Medium 51.0%
0881 Boats to Save People [Go]({{< relref "/ChapterFour/0800~0899/0881.Boats-to-Save-People.md" >}}) Medium 49.6%
0888 Fair Candy Swap [Go]({{< relref "/ChapterFour/0800~0899/0888.Fair-Candy-Swap.md" >}}) Easy 60.0%
0891 Sum of Subsequence Widths [Go]({{< relref "/ChapterFour/0800~0899/0891.Sum-of-Subsequence-Widths.md" >}}) Hard 33.9%
0910 Smallest Range II [Go]({{< relref "/ChapterFour/0900~0999/0910.Smallest-Range-II.md" >}}) Medium 31.9%
0922 Sort Array By Parity II [Go]({{< relref "/ChapterFour/0900~0999/0922.Sort-Array-By-Parity-II.md" >}}) Easy O(n) O(1) 70.6%
0923 3Sum With Multiplicity [Go]({{< relref "/ChapterFour/0900~0999/0923.3Sum-With-Multiplicity.md" >}}) Medium 41.2%
0969 Pancake Sorting [Go]({{< relref "/ChapterFour/0900~0999/0969.Pancake-Sorting.md" >}}) Medium O(n log n) O(log n) ❤️ 69.3%
0973 K Closest Points to Origin [Go]({{< relref "/ChapterFour/0900~0999/0973.K-Closest-Points-to-Origin.md" >}}) Medium O(n log n) O(log n) 65.7%
0976 Largest Perimeter Triangle [Go]({{< relref "/ChapterFour/0900~0999/0976.Largest-Perimeter-Triangle.md" >}}) Easy O(n log n) O(log n) 59.9%
0977 Squares of a Sorted Array [Go]({{< relref "/ChapterFour/0900~0999/0977.Squares-of-a-Sorted-Array.md" >}}) Easy 71.5%
1005 Maximize Sum Of Array After K Negations [Go]({{< relref "/ChapterFour/1000~1099/1005.Maximize-Sum-Of-Array-After-K-Negations.md" >}}) Easy 51.9%
1030 Matrix Cells in Distance Order [Go]({{< relref "/ChapterFour/1000~1099/1030.Matrix-Cells-in-Distance-Order.md" >}}) Easy O(n^2) O(1) 68.8%
1040 Moving Stones Until Consecutive II [Go]({{< relref "/ChapterFour/1000~1099/1040.Moving-Stones-Until-Consecutive-II.md" >}}) Medium 54.9%
1051 Height Checker [Go]({{< relref "/ChapterFour/1000~1099/1051.Height-Checker.md" >}}) Easy 73.7%
1054 Distant Barcodes [Go]({{< relref "/ChapterFour/1000~1099/1054.Distant-Barcodes.md" >}}) Medium O(n log n) O(log n) ❤️ 45.0%
1122 Relative Sort Array [Go]({{< relref "/ChapterFour/1100~1199/1122.Relative-Sort-Array.md" >}}) Easy 67.9%
1170 Compare Strings by Frequency of the Smallest Character [Go]({{< relref "/ChapterFour/1100~1199/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md" >}}) Medium 60.8%
1200 Minimum Absolute Difference [Go]({{< relref "/ChapterFour/1200~1299/1200.Minimum-Absolute-Difference.md" >}}) Easy 67.6%
1235 Maximum Profit in Job Scheduling [Go]({{< relref "/ChapterFour/1200~1299/1235.Maximum-Profit-in-Job-Scheduling.md" >}}) Hard 50.3%
1300 Sum of Mutated Array Closest to Target [Go]({{< relref "/ChapterFour/1300~1399/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}}) Medium 42.4%
1305 All Elements in Two Binary Search Trees [Go]({{< relref "/ChapterFour/1300~1399/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}}) Medium 78.5%
1329 Sort the Matrix Diagonally [Go]({{< relref "/ChapterFour/1300~1399/1329.Sort-the-Matrix-Diagonally.md" >}}) Medium 81.5%
1337 The K Weakest Rows in a Matrix [Go]({{< relref "/ChapterFour/1300~1399/1337.The-K-Weakest-Rows-in-a-Matrix.md" >}}) Easy 72.1%
1383 Maximum Performance of a Team [Go]({{< relref "/ChapterFour/1300~1399/1383.Maximum-Performance-of-a-Team.md" >}}) Hard 41.3%
1385 Find the Distance Value Between Two Arrays [Go]({{< relref "/ChapterFour/1300~1399/1385.Find-the-Distance-Value-Between-Two-Arrays.md" >}}) Easy 66.4%
1464 Maximum Product of Two Elements in an Array [Go]({{< relref "/ChapterFour/1400~1499/1464.Maximum-Product-of-Two-Elements-in-an-Array.md" >}}) Easy 77.6%
1465 Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts [Go]({{< relref "/ChapterFour/1400~1499/1465.Maximum-Area-of-a-Piece-of-Cake-After-Horizontal-and-Vertical-Cuts.md" >}}) Medium 36.9%
1608 Special Array With X Elements Greater Than or Equal X [Go]({{< relref "/ChapterFour/1600~1699/1608.Special-Array-With-X-Elements-Greater-Than-or-Equal-X.md" >}}) Easy 60.9%
1619 Mean of Array After Removing Some Elements [Go]({{< relref "/ChapterFour/1600~1699/1619.Mean-of-Array-After-Removing-Some-Elements.md" >}}) Easy 64.6%
1636 Sort Array by Increasing Frequency [Go]({{< relref "/ChapterFour/1600~1699/1636.Sort-Array-by-Increasing-Frequency.md" >}}) Easy 67.9%
1647 Minimum Deletions to Make Character Frequencies Unique [Go]({{< relref "/ChapterFour/1600~1699/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}}) Medium 56.0%
1648 Sell Diminishing-Valued Colored Balls [Go]({{< relref "/ChapterFour/1600~1699/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}}) Medium 31.4%
1657 Determine if Two Strings Are Close [Go]({{< relref "/ChapterFour/1600~1699/1657.Determine-if-Two-Strings-Are-Close.md" >}}) Medium 54.7%
1665 Minimum Initial Energy to Finish Tasks [Go]({{< relref "/ChapterFour/1600~1699/1665.Minimum-Initial-Energy-to-Finish-Tasks.md" >}}) Hard 55.3%
1679 Max Number of K-Sum Pairs [Go]({{< relref "/ChapterFour/1600~1699/1679.Max-Number-of-K-Sum-Pairs.md" >}}) Medium 53.5%
1691 Maximum Height by Stacking Cuboids [Go]({{< relref "/ChapterFour/1600~1699/1691.Maximum-Height-by-Stacking-Cuboids.md" >}}) Hard 52.4%
1710 Maximum Units on a Truck [Go]({{< relref "/ChapterFour/1700~1799/1710.Maximum-Units-on-a-Truck.md" >}}) Easy 72.1%
1818 Minimum Absolute Sum Difference [Go]({{< relref "/ChapterFour/1800~1899/1818.Minimum-Absolute-Sum-Difference.md" >}}) Medium 28.3%
1846 Maximum Element After Decreasing and Rearranging [Go]({{< relref "/ChapterFour/1800~1899/1846.Maximum-Element-After-Decreasing-and-Rearranging.md" >}}) Medium 55.9%
1877 Minimize Maximum Pair Sum in Array [Go]({{< relref "/ChapterFour/1800~1899/1877.Minimize-Maximum-Pair-Sum-in-Array.md" >}}) Medium 80.0%
------------ ------------------------------------------------------- ------- ---------------- --------------- ------------- ------------- -------------