Sorting
Bucket Sort¶
- 912. Sort an Array
 - 692. Top K Frequent Words
 - 451. Sort Characters By Frequency
 - 347. Top K Frequent Elements
 - 220. Contains Duplicate III
 - 164. Maximum Gap
 
Counting Sort¶
- 3517. Smallest Palindromic Rearrangement I
 - 3189. Minimum Moves to Get a Peaceful Board
 - 3088. Make String Anti-palindrome
 - 2037. Minimum Number of Moves to Seat Everyone
 - 1833. Maximum Ice Cream Bars
 - 1365. How Many Numbers Are Smaller Than the Current Number
 - 1122. Relative Sort Array
 - 1051. Height Checker
 - 912. Sort an Array
 - 561. Array Partition
 - 274. H-Index
 
Merge Sort¶
- 3109. Find the Index of Permutation
 - 2519. Count the Number of K-Big Indices
 - 2426. Number of Pairs Satisfying Inequality
 - 2179. Count Good Triplets in an Array
 - 2031. Count Subarrays With More Ones Than Zeros
 - 1649. Create Sorted Array through Instructions
 - 912. Sort an Array
 - 493. Reverse Pairs
 - 327. Count of Range Sum
 - 315. Count of Smaller Numbers After Self
 - 148. Sort List
 - 23. Merge k Sorted Lists
 
Quickselect¶
- 2343. Query Kth Smallest Trimmed Number
 - 1985. Find the Kth Largest Integer in the Array
 - 1738. Find Kth Largest XOR Coordinate Value
 - 973. K Closest Points to Origin
 - 347. Top K Frequent Elements
 - 324. Wiggle Sort II
 - 215. Kth Largest Element in an Array
 
Radix Sort¶
Sorting¶
- 3556. Sum of Largest Prime Substrings
 - 3555. Smallest Subarray to Sort in Every Sliding Window
 - 3551. Minimum Swaps to Sort by Digit Sum
 - 3547. Maximum Sum of Edge Values in a Graph
 - 3545. Minimum Deletions for At Most K Distinct Characters
 - 3536. Maximum Product of Two Digits
 - 3534. Path Existence Queries in a Graph II
 - 3531. Count Covered Buildings
 - 3517. Smallest Palindromic Rearrangement I
 - 3491. Phone Number Prefix
 - 3478. Choose K Elements With Maximum Sum
 - 3476. Maximize Profit from Task Assignment
 - 3467. Transform Array by Parity
 - 3462. Maximum Sum With at Most K Elements
 - 3458. Select K Disjoint Special Substrings
 - 3457. Eat Pizzas!
 - 3446. Sort Matrix by Diagonals
 - 3433. Count Mentions Per User
 - 3428. Maximum and Minimum Sums of at Most Size K Subsequences
 - 3424. Minimum Cost to Make Arrays Identical
 - 3414. Maximum Score of Non-overlapping Intervals
 - 3413. Maximum Coins From K Consecutive Bags
 - 3397. Maximum Number of Distinct Elements After Operations
 - 3394. Check if Grid can be Cut into Sections
 - 3382. Maximum Area Rectangle With Point Constraints II
 - 3380. Maximum Area Rectangle With Point Constraints I
 - 3365. Rearrange K Substrings to Form Target String
 - 3362. Zero Array Transformation III
 - 3347. Maximum Frequency of an Element After Performing Operations II
 - 3346. Maximum Frequency of an Element After Performing Operations I
 - 3323. Minimize Connected Groups by Inserting Interval
 - 3319. K-th Largest Perfect Subtree Size in Binary Tree
 - 3301. Maximize the Total Height of Unique Towers
 - 3288. Length of the Longest Increasing Path
 - 3281. Maximize Score of Numbers in Ranges
 - 3273. Minimum Amount of Damage Dealt to Bob
 - 3267. Count Almost Equal Pairs II
 - 3265. Count Almost Equal Pairs I
 - 3219. Minimum Cost for Cutting Cake II
 - 3218. Minimum Cost for Cutting Cake I
 - 3194. Minimum Average of Smallest and Largest Elements
 - 3189. Minimum Moves to Get a Peaceful Board
 - 3186. Maximum Total Damage With Spell Casting
 - 3169. Count Days Without Meetings
 - 3167. Better Compression of String
 - 3143. Maximum Points Inside the Square
 - 3132. Find the Integer Added to Array II
 - 3125. Maximum Number That Makes Result of Bitwise AND Zero
 - 3119. Maximum Number of Potholes That Can Be Fixed
 - 3111. Minimum Rectangles to Cover Points
 - 3107. Minimum Operations to Make Median of Array Equal to K
 - 3102. Minimize Manhattan Distances
 - 3098. Find the Sum of Subsequence Powers
 - 3088. Make String Anti-palindrome
 - 3085. Minimum Deletions to Make String K-Special
 - 3081. Replace Question Marks in String to Minimize Its Value
 - 3080. Mark Elements on Array by Performing Queries
 - 3075. Maximize Happiness of Selected Children
 - 3074. Apple Redistribution into Boxes
 - 3068. Find the Maximum Sum of Node Values
 - 3041. Maximize Consecutive Elements in an Array After Modification
 - 3039. Apply Operations to Make String Empty
 - 3035. Maximum Palindromes After Operations
 - 3027. Find the Number of Ways to Place People II
 - 3025. Find the Number of Ways to Place People I
 - 3024. Type of Triangle
 - 3016. Minimum Number of Pushes to Type Word II
 - 3011. Find if Array Can Be Sorted
 - 3010. Divide an Array Into Subarrays With Minimum Cost I
 - 2996. Smallest Missing Integer Greater Than Sequential Prefix Sum
 - 2974. Minimum Number Game
 - 2973. Find Number of Coins to Place in Tree Nodes
 - 2971. Find Polygon With the Largest Perimeter
 - 2968. Apply Operations to Maximize Frequency Score
 - 2967. Minimum Cost to Make Array Equalindromic
 - 2966. Divide Array Into Arrays With Max Difference
 - 2952. Minimum Number of Coins to be Added
 - 2948. Make Lexicographically Smallest Array by Swapping Elements
 - 2943. Maximize Area of Square Hole in Grid
 - 2933. High-Access Employees
 - 2931. Maximum Spending After Buying Items
 - 2895. Minimum Processing Time
 - 2863. Maximum Length of Semi-Decreasing Subarrays
 - 2860. Happy Students
 - 2840. Check if Strings Can be Made Equal With Operations II
 - 2838. Maximum Coins Heroes Can Collect
 - 2830. Maximize the Profit as the Salesman
 - 2824. Count Pairs Whose Sum is Less than Target
 - 2819. Minimum Relative Loss After Buying Chocolates
 - 2818. Apply Operations to Maximize Score
 - 2813. Maximum Elegance of a K-Length Subsequence
 - 2809. Minimum Time to Make Array Sum At Most x
 - 2790. Maximum Number of Groups With Increasing Length
 - 2785. Sort Vowels in a String
 - 2784. Check if Array is Good
 - 2780. Minimum Index of a Valid Split
 - 2779. Maximum Beauty of an Array After Applying Operation
 - 2766. Relocate Marbles
 - 2751. Robot Collisions
 - 2747. Count Zero Request Servers
 - 2740. Find the Value of the Partition
 - 2736. Maximum Sum Queries
 - 2733. Neither Minimum nor Maximum
 - 2731. Movement of Robots
 - 2713. Maximum Strictly Increasing Cells in a Matrix
 - 2708. Maximum Strength of a Group
 - 2706. Buy Two Chocolates
 - 2681. Power of Heroes
 - 2679. Sum in a Matrix
 - 2659. Make Array Empty
 - 2655. Find Maximal Uncovered Ranges
 - 2638. Count the Number of K-Free Subsets
 - 2616. Minimize the Maximum Difference of Pairs
 - 2613. Beautiful Pairs
 - 2611. Mice and Cheese
 - 2607. Make K-Subarray Sums Equal
 - 2604. Minimum Time to Eat All Grains
 - 2602. Minimum Operations to Make All Array Elements Equal
 - 2597. The Number of Beautiful Subsets
 - 2593. Find Score of an Array After Marking All Elements
 - 2592. Maximize Greatness of an Array
 - 2590. Design a Todo List
 - 2589. Minimum Time to Complete All Tasks
 - 2587. Rearrange Array to Maximize Prefix Score
 - 2583. Kth Largest Sum in a Binary Tree
 - 2580. Count Ways to Group Overlapping Ranges
 - 2578. Split With Minimum Sum
 - 2576. Find the Maximum Number of Marked Indices
 - 2567. Minimum Score by Changing Two Elements
 - 2563. Count the Number of Fair Pairs
 - 2557. Maximum Number of Integers to Choose From a Range II
 - 2554. Maximum Number of Integers to Choose From a Range I
 - 2551. Put Marbles in Bags
 - 2548. Maximum Price to Fill a Bag
 - 2545. Sort the Students by Their Kth Score
 - 2542. Maximum Subsequence Score
 - 2517. Maximum Tastiness of Candy Basket
 - 2512. Reward Top K Students
 - 2503. Maximum Number of Points From Grid Queries
 - 2501. Longest Square Streak in an Array
 - 2500. Delete Greatest Value in Each Row
 - 2497. Maximum Star Sum of a Graph
 - 2491. Divide Players Into Teams of Equal Skill
 - 2475. Number of Unequal Triplets in Array
 - 2465. Number of Distinct Averages
 - 2463. Minimum Total Distance Traveled
 - 2459. Sort Array by Moving Items to Empty Space
 - 2456. Most Popular Video Creator
 - 2454. Next Greater Element IV
 - 2449. Minimum Number of Operations to Make Arrays Similar
 - 2448. Minimum Cost to Make Array Equal
 - 2441. Largest Positive Integer That Exists With Its Negative
 - 2421. Number of Good Paths
 - 2418. Sort the People
 - 2412. Minimum Money Required Before Transactions
 - 2410. Maximum Matching of Players With Trainers
 - 2406. Divide Intervals Into Minimum Number of Groups
 - 2402. Meeting Rooms III
 - 2389. Longest Subsequence With Limited Sum
 - 2386. Find the K-Sum of an Array
 - 2371. Minimize Maximum Value in a Grid
 - 2363. Merge Similar Items
 - 2357. Make Array Zero by Subtracting Equal Amounts
 - 2345. Finding the Number of Visible Mountains
 - 2344. Minimum Deletions to Make Array Divisible
 - 2343. Query Kth Smallest Trimmed Number
 - 2342. Max Sum of a Pair With Equal Sum of Digits
 - 2335. Minimum Amount of Time to Fill Cups
 - 2333. Minimum Sum of Squared Difference
 - 2332. The Latest Time to Catch a Bus
 - 2323. Find Minimum Time to Finish All Jobs II
 - 2300. Successful Pairs of Spells and Potions
 - 2294. Partition Array Such That Maximum Difference Is K
 - 2285. Maximum Total Importance of Roads
 - 2280. Minimum Lines to Represent a Line Chart
 - 2279. Maximum Bags With Full Capacity of Rocks
 - 2274. Maximum Consecutive Floors Without Special Floors
 - 2273. Find Resultant Array After Removing Anagrams
 - 2271. Maximum White Tiles Covered by a Carpet
 - 2268. Minimum Number of Keypresses
 - 2251. Number of Flowers in Full Bloom
 - 2250. Count Number of Rectangles Containing Each Point
 - 2248. Intersection of Multiple Arrays
 - 2242. Maximum Score of a Node Sequence
 - 2234. Maximum Total Beauty of the Gardens
 - 2231. Largest Number After Digit Swaps by Parity
 - 2229. Check if an Array Is Consecutive
 - 2225. Find Players With Zero or One Losses
 - 2195. Append K Integers With Minimal Sum
 - 2191. Sort the Jumbled Numbers
 - 2171. Removing Minimum Number of Magic Beans
 - 2165. Smallest Value of the Rearranged Number
 - 2164. Sort Even and Odd Indices Independently
 - 2160. Minimum Sum of Four Digit Number After Splitting Digits
 - 2154. Keep Multiplying Found Values by Two
 - 2148. Count Elements With Strictly Smaller and Greater Elements
 - 2146. K Highest Ranked Items Within a Price Range
 - 2144. Minimum Cost of Buying Candies With Discount
 - 2141. Maximum Running Time of N Computers
 - 2136. Earliest Possible Day of Full Bloom
 - 2135. Count Words Obtained After Adding a Letter
 - 2126. Destroying Asteroids
 - 2122. Recover the Original Array
 - 2099. Find Subsequence of Length K With the Largest Sum
 - 2098. Subsequence of Size K With the Largest Even Sum
 - 2094. Finding 3-Digit Even Numbers
 - 2092. Find All People With Secret
 - 2089. Find Target Indices After Sorting Array
 - 2071. Maximum Number of Tasks You Can Assign
 - 2070. Most Beautiful Item for Each Query
 - 2054. Two Best Non-Overlapping Events
 - 2046. Sort Linked List Already Sorted Using Absolute Values
 - 2037. Minimum Number of Moves to Seat Everyone
 - 2033. Minimum Operations to Make a Uni-Value Grid
 - 2021. Brightest Position on Street
 - 2015. Average Height of Buildings in Each Segment
 - 2008. Maximum Earnings From Taxi
 - 2007. Find Original Array From Doubled Array
 - 1998. GCD Sort of an Array
 - 1996. The Number of Weak Characters in the Game
 - 1985. Find the Kth Largest Integer in the Array
 - 1984. Minimum Difference Between Highest and Lowest of K Scores
 - 1968. Array With Elements Not Equal to Average of Neighbors
 - 1943. Describe the Painting
 - 1921. Eliminate Maximum Number of Monsters
 - 1913. Maximum Product Difference Between Two Pairs
 - 1889. Minimum Space Wasted From Packaging
 - 1887. Reduction Operations to Make the Array Elements Equal
 - 1885. Count Pairs in Two Arrays
 - 1878. Get Biggest Three Rhombus Sums in a Grid
 - 1877. Minimize Maximum Pair Sum in Array
 - 1874. Minimize Product Sum of Two Arrays
 - 1859. Sorting the Sentence
 - 1851. Minimum Interval to Include Each Query
 - 1847. Closest Room
 - 1846. Maximum Element After Decreasing and Rearranging
 - 1840. Maximum Building Height
 - 1838. Frequency of the Most Frequent Element
 - 1834. Single-Threaded CPU
 - 1833. Maximum Ice Cream Bars
 - 1818. Minimum Absolute Sum Difference
 - 1798. Maximum Number of Consecutive Values You Can Make
 - 1782. Count Pairs Of Nodes
 - 1772. Sort Features by Popularity
 - 1755. Closest Subsequence Sum
 - 1751. Maximum Number of Events That Can Be Attended II
 - 1738. Find Kth Largest XOR Coordinate Value
 - 1727. Largest Submatrix With Rearrangements
 - 1710. Maximum Units on a Truck
 - 1697. Checking Existence of Edge Length Limited Paths
 - 1691. Maximum Height by Stacking Cuboids
 - 1686. Stone Game VI
 - 1679. Max Number of K-Sum Pairs
 - 1665. Minimum Initial Energy to Finish Tasks
 - 1657. Determine if Two Strings Are Close
 - 1648. Sell Diminishing-Valued Colored Balls
 - 1647. Minimum Deletions to Make Character Frequencies Unique
 - 1637. Widest Vertical Area Between Two Points Containing No Points
 - 1636. Sort Array by Increasing Frequency
 - 1632. Rank Transform of a Matrix
 - 1630. Arithmetic Subarrays
 - 1626. Best Team With No Conflicts
 - 1619. Mean of Array After Removing Some Elements
 - 1610. Maximum Number of Visible Points
 - 1608. Special Array With X Elements Greater Than or Equal X
 - 1604. Alert Using Same Key-Card Three or More Times in a One Hour Period
 - 1589. Maximum Sum Obtained of Any Permutation
 - 1585. Check If String Is Transformable With Substring Sort Operations
 - 1580. Put Boxes Into the Warehouse II
 - 1564. Put Boxes Into the Warehouse I
 - 1561. Maximum Number of Coins You Can Get
 - 1552. Magnetic Force Between Two Balls
 - 1547. Minimum Cost to Cut a Stick
 - 1509. Minimum Difference Between Largest and Smallest Value in Three Moves
 - 1508. Range Sum of Sorted Subarray Sums
 - 1502. Can Make Arithmetic Progression From Sequence
 - 1500. Design a File Sharing System
 - 1498. Number of Subsequences That Satisfy the Given Sum Condition
 - 1491. Average Salary Excluding the Minimum and Maximum Salary
 - 1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree
 - 1481. Least Number of Unique Integers after K Removals
 - 1478. Allocate Mailboxes
 - 1471. The k Strongest Values in an Array
 - 1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts
 - 1464. Maximum Product of Two Elements in an Array
 - 1460. Make Two Arrays Equal by Reversing Subarrays
 - 1451. Rearrange Words in a Sentence
 - 1433. Check If a String Can Break Another String
 - 1424. Diagonal Traverse II
 - 1418. Display Table of Food Orders in a Restaurant
 - 1403. Minimum Subsequence in Non-Increasing Order
 - 1402. Reducing Dishes
 - 1387. Sort Integers by The Power Value
 - 1385. Find the Distance Value Between Two Arrays
 - 1383. Maximum Performance of a Team
 - 1366. Rank Teams by Votes
 - 1365. How Many Numbers Are Smaller Than the Current Number
 - 1363. Largest Multiple of Three
 - 1356. Sort Integers by The Number of 1 Bits
 - 1353. Maximum Number of Events That Can Be Attended
 - 1348. Tweet Counts Per Frequency
 - 1346. Check If N and Its Double Exist
 - 1340. Jump Game V
 - 1338. Reduce Array Size to The Half
 - 1337. The K Weakest Rows in a Matrix
 - 1333. Filter Restaurants by Vegan-Friendly, Price and Distance
 - 1331. Rank Transform of an Array
 - 1329. Sort the Matrix Diagonally
 - 1311. Get Watched Videos by Your Friends
 - 1305. All Elements in Two Binary Search Trees
 - 1300. Sum of Mutated Array Closest to Target
 - 1296. Divide Array in Sets of K Consecutive Numbers
 - 1288. Remove Covered Intervals
 - 1268. Search Suggestions System
 - 1262. Greatest Sum Divisible by Three
 - 1244. Design A Leaderboard
 - 1235. Maximum Profit in Job Scheduling
 - 1229. Meeting Scheduler
 - 1202. Smallest String With Swaps
 - 1200. Minimum Absolute Difference
 - 1196. How Many Apples Can You Put into the Basket
 - 1187. Make Array Strictly Increasing
 - 1183. Maximum Number of Ones
 - 1181. Before and After Puzzle
 - 1170. Compare Strings by Frequency of the Smallest Character
 - 1169. Invalid Transactions
 - 1152. Analyze User Website Visit Pattern
 - 1133. Largest Unique Number
 - 1122. Relative Sort Array
 - 1101. The Earliest Moment When Everyone Become Friends
 - 1099. Two Sum Less Than K
 - 1094. Car Pooling
 - 1090. Largest Values From Labels
 - 1086. High Five
 - 1065. Index Pairs of a String
 - 1058. Minimize Rounding Error to Meet Target
 - 1057. Campus Bikes
 - 1054. Distant Barcodes
 - 1051. Height Checker
 - 1048. Longest String Chain
 - 1040. Moving Stones Until Consecutive II
 - 1030. Matrix Cells in Distance Order
 - 1029. Two City Scheduling
 - 1005. Maximize Sum Of Array After K Negations
 - 987. Vertical Order Traversal of a Binary Tree
 - 977. Squares of a Sorted Array
 - 976. Largest Perimeter Triangle
 - 975. Odd Even Jump
 - 973. K Closest Points to Origin
 - 969. Pancake Sorting
 - 954. Array of Doubled Pairs
 - 950. Reveal Cards In Increasing Order
 - 948. Bag of Tokens
 - 945. Minimum Increment to Make Array Unique
 - 939. Minimum Area Rectangle
 - 937. Reorder Data in Log Files
 - 923. 3Sum With Multiplicity
 - 922. Sort Array By Parity II
 - 912. Sort an Array
 - 910. Smallest Range II
 - 905. Sort Array By Parity
 - 899. Orderly Queue
 - 893. Groups of Special-Equivalent Strings
 - 891. Sum of Subsequence Widths
 - 888. Fair Candy Swap
 - 881. Boats to Save People
 - 870. Advantage Shuffle
 - 869. Reordered Power of 2
 - 857. Minimum Cost to Hire K Workers
 - 853. Car Fleet
 - 846. Hand of Straights
 - 833. Find And Replace in String
 - 826. Most Profit Assigning Work
 - 825. Friends Of Appropriate Ages
 - 823. Binary Trees With Factors
 - 792. Number of Matching Subsequences
 - 791. Custom Sort String
 - 786. K-th Smallest Prime Fraction
 - 769. Max Chunks To Make Sorted
 - 768. Max Chunks To Make Sorted II
 - 767. Reorganize String
 - 759. Employee Free Time
 - 757. Set Intersection Size At Least Two
 - 747. Largest Number At Least Twice of Others
 - 726. Number of Atoms
 - 721. Accounts Merge
 - 720. Longest Word in Dictionary
 - 719. Find K-th Smallest Pair Distance
 - 710. Random Pick with Blacklist
 - 692. Top K Frequent Words
 - 658. Find K Closest Elements
 - 646. Maximum Length of Pair Chain
 - 645. Set Mismatch
 - 642. Design Search Autocomplete System
 - 632. Smallest Range Covering Elements from K Lists
 - 630. Course Schedule III
 - 628. Maximum Product of Three Numbers
 - 621. Task Scheduler
 - 611. Valid Triangle Number
 - 594. Longest Harmonious Subsequence
 - 588. Design In-Memory File System
 - 581. Shortest Unsorted Continuous Subarray
 - 561. Array Partition
 - 539. Minimum Time Difference
 - 532. K-diff Pairs in an Array
 - 527. Word Abbreviation
 - 524. Longest Word in Dictionary through Deleting
 - 522. Longest Uncommon Subsequence II
 - 506. Relative Ranks
 - 502. IPO
 - 475. Heaters
 - 472. Concatenated Words
 - 462. Minimum Moves to Equal Array Elements II
 - 455. Assign Cookies
 - 452. Minimum Number of Arrows to Burst Balloons
 - 451. Sort Characters By Frequency
 - 436. Find Right Interval
 - 435. Non-overlapping Intervals
 - 414. Third Maximum Number
 - 406. Queue Reconstruction by Height
 - 389. Find the Difference
 - 378. Kth Smallest Element in a Sorted Matrix
 - 368. Largest Divisible Subset
 - 360. Sort Transformed Array
 - 358. Rearrange String k Distance Apart
 - 354. Russian Doll Envelopes
 - 350. Intersection of Two Arrays II
 - 349. Intersection of Two Arrays
 - 347. Top K Frequent Elements
 - 324. Wiggle Sort II
 - 314. Binary Tree Vertical Order Traversal
 - 296. Best Meeting Point
 - 295. Find Median from Data Stream
 - 280. Wiggle Sort
 - 274. H-Index
 - 268. Missing Number
 - 259. 3Sum Smaller
 - 253. Meeting Rooms II
 - 252. Meeting Rooms
 - 242. Valid Anagram
 - 229. Majority Element II
 - 220. Contains Duplicate III
 - 217. Contains Duplicate
 - 215. Kth Largest Element in an Array
 - 179. Largest Number
 - 169. Majority Element
 - 164. Maximum Gap
 - 148. Sort List
 - 147. Insertion Sort List
 - 88. Merge Sorted Array
 - 75. Sort Colors
 - 56. Merge Intervals
 - 49. Group Anagrams
 - 47. Permutations II
 - 18. 4Sum
 - 16. 3Sum Closest
 - 15. 3Sum