2.14 ✅ Sorting

# Sorting #

• 深刻的理解多路快排。第 75 题。
• 链表的排序，插入排序(第 147 题)和归并排序(第 148 题)
• 桶排序和基数排序。第 164 题。
• “摆动排序”。第 324 题。
• 两两不相邻的排序。第 767 题，第 1054 题。
• “饼子排序”。第 969 题。
No.TitleSolutionDifficultyTimeComplexitySpaceComplexityFavoriteAcceptance
00153SumGoMedium32.6%
00163Sum ClosestGoMedium45.8%
00184SumGoMedium35.9%
0049Group AnagramsGoMedium66.7%
0056Merge IntervalsGoMediumO(n log n)O(log n)46.2%
0075Sort ColorsGoMediumO(n)O(1)❤️58.5%
0088Merge Sorted ArrayGoEasy46.6%
0147Insertion Sort ListGoMediumO(n^2)O(1)❤️51.0%
0148Sort ListGoMediumO(n log n)O(log n)❤️55.1%
0164Maximum GapGoHardO(n log n)O(log n)❤️43.3%
0169Majority ElementGoEasy63.9%
0179Largest NumberGoMediumO(n log n)O(log n)❤️34.5%
0215Kth Largest Element in an ArrayGoMedium66.1%
0217Contains DuplicateGoEasy61.4%
0220Contains Duplicate IIIGoHardO(n log n)O(1)❤️22.1%
0229Majority Element IIGoMedium45.0%
0242Valid AnagramGoEasyO(n)O(n)63.0%
0268Missing NumberGoEasy62.5%
0274H-IndexGoMediumO(n)O(n)38.3%
0324Wiggle Sort IIGoMediumO(n)O(n)❤️33.3%
0347Top K Frequent ElementsGoMedium64.2%
0349Intersection of Two ArraysGoEasyO(n)O(n)70.9%
0350Intersection of Two Arrays IIGoEasyO(n)O(n)56.0%
0354Russian Doll EnvelopesGoHard38.0%
0368Largest Divisible SubsetGoMedium41.5%
0378Kth Smallest Element in a Sorted MatrixGoMedium61.7%
0389Find the DifferenceGoEasy59.9%
0414Third Maximum NumberGoEasy33.2%
0435Non-overlapping IntervalsGoMedium50.3%
0436Find Right IntervalGoMedium50.8%
0451Sort Characters By FrequencyGoMedium70.1%
0462Minimum Moves to Equal Array Elements IIGoMedium60.0%
0475HeatersGoMedium36.5%
0506Relative RanksGoEasy60.5%
0524Longest Word in Dictionary through DeletingGoMediumO(n)O(1)51.0%
0532K-diff Pairs in an ArrayGoMedium41.2%
0561Array PartitionGoEasy77.2%
0581Shortest Unsorted Continuous SubarrayGoMedium36.4%
0594Longest Harmonious SubsequenceGoEasy53.5%
0611Valid Triangle NumberGoMedium50.5%
0628Maximum Product of Three NumbersGoEasy45.9%
0632Smallest Range Covering Elements from K ListsGoHard61.0%
0645Set MismatchGoEasy42.7%
0658Find K Closest ElementsGoMedium46.8%
0692Top K Frequent WordsGoMedium57.2%
0710Random Pick with BlacklistGoHardO(n)O(n)33.5%
0719Find K-th Smallest Pair DistanceGoHard36.7%
0720Longest Word in DictionaryGoMedium52.0%
0726Number of AtomsGoHard52.1%
0747Largest Number At Least Twice of OthersGoEasy47.1%
0767Reorganize StringGoMediumO(n log n)O(log n)❤️52.9%
0786K-th Smallest Prime FractionGoMedium51.6%
0791Custom Sort StringGoMedium69.1%
0792Number of Matching SubsequencesGoMedium51.6%
0825Friends Of Appropriate AgesGoMedium46.3%
0826Most Profit Assigning WorkGoMedium44.9%
0846Hand of StraightsGoMedium56.2%
0853Car FleetGoMediumO(n log n)O(log n)50.3%
0869Reordered Power of 2GoMedium63.5%
0881Boats to Save PeopleGoMedium53.1%
0888Fair Candy SwapGoEasy60.7%
0891Sum of Subsequence WidthsGoHard36.6%
0910Smallest Range IIGoMedium35.1%
0922Sort Array By Parity IIGoEasyO(n)O(1)70.7%
09233Sum With MultiplicityGoMedium45.3%
0969Pancake SortingGoMediumO(n log n)O(log n)❤️70.1%
0973K Closest Points to OriginGoMediumO(n log n)O(log n)65.7%
0976Largest Perimeter TriangleGoEasyO(n log n)O(log n)54.6%
0977Squares of a Sorted ArrayGoEasy71.9%
1005Maximize Sum Of Array After K NegationsGoEasy50.9%
1030Matrix Cells in Distance OrderGoEasyO(n^2)O(1)69.7%
1040Moving Stones Until Consecutive IIGoMedium55.9%
1051Height CheckerGoEasy75.6%
1054Distant BarcodesGoMediumO(n log n)O(log n)❤️45.8%
1122Relative Sort ArrayGoEasy68.6%
1170Compare Strings by Frequency of the Smallest CharacterGoMedium61.5%
1200Minimum Absolute DifferenceGoEasy69.6%
1235Maximum Profit in Job SchedulingGoHard53.4%
1296Divide Array in Sets of K Consecutive NumbersGoMedium56.5%
1300Sum of Mutated Array Closest to TargetGoMedium43.6%
1305All Elements in Two Binary Search TreesGoMedium79.8%
1329Sort the Matrix DiagonallyGoMedium83.3%
1337The K Weakest Rows in a MatrixGoEasy72.1%
1353Maximum Number of Events That Can Be AttendedGoMedium32.5%
1383Maximum Performance of a TeamGoHard48.5%
1385Find the Distance Value Between Two ArraysGoEasy66.5%
1464Maximum Product of Two Elements in an ArrayGoEasy79.9%
1465Maximum Area of a Piece of Cake After Horizontal and Vertical CutsGoMedium40.9%
1608Special Array With X Elements Greater Than or Equal XGoEasy60.5%
1619Mean of Array After Removing Some ElementsGoEasy65.7%
1636Sort Array by Increasing FrequencyGoEasy69.5%
1647Minimum Deletions to Make Character Frequencies UniqueGoMedium59.1%
1648Sell Diminishing-Valued Colored BallsGoMedium30.5%
1657Determine if Two Strings Are CloseGoMedium56.3%
1665Minimum Initial Energy to Finish TasksGoHard56.3%
1679Max Number of K-Sum PairsGoMedium57.3%
1691Maximum Height by Stacking CuboidsGoHard54.4%
1710Maximum Units on a TruckGoEasy73.8%
1818Minimum Absolute Sum DifferenceGoMedium30.4%
1846Maximum Element After Decreasing and RearrangingGoMedium58.9%
1877Minimize Maximum Pair Sum in ArrayGoMedium79.9%
1984Minimum Difference Between Highest and Lowest of K ScoresGoEasy54.4%
2037Minimum Number of Moves to Seat EveryoneGoEasy82.1%
2164Sort Even and Odd Indices IndependentlyGoEasy65.0%
2165Smallest Value of the Rearranged NumberGoMedium51.4%
2171Removing Minimum Number of Magic BeansGoMedium42.1%
——————————————————————-——-—————-—————————-————-————-

Apr 8, 2023