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