← back

Sorting

437 questions · 0 seen

All Sorting problems

Problems

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