Sorting coding problems
Sorting is often the step that makes a hard problem easy. Practise custom comparators, sorting by several keys, counting sort and the problems where sorted order reveals the answer.
36 problems: 15 easy, 20 medium, 1 hard. Free to read; a free account solves them and earns XP and Aura.
- Count Distinct ElementsPractice · +10 XP · sorting, counting, arrayseasy
- Count Pairs with Smaller SumPractice · +10 XP · two pointers, sorting, countingeasy
- Find Second Largest ElementPractice · +10 XP · arrays, sorting, loopseasy
- Find Second MinimumPractice · +10 XP · basics, sorting, conditionalseasy
- Minimum Absolute DifferencePractice · +10 XP · greedy, sorting, arrayseasy
- Minimum Cost to SortPractice · +10 XP · greedy, sorting, bubble sorteasy
- Sort by Digit CountPractice · +10 XP · sorting, counting sort, custom ordereasy
- Sort by Length and LexicographicallyPractice · +10 XP · sorting, stringseasy
- Sort by Number of Set BitsPractice · +10 XP · sorting, counting sort, bit manipulationeasy
- Sort by ParityPractice · +10 XP · sorting, custom ordereasy
- Sort by Parity CountPractice · +10 XP · sorting, custom sortingeasy
- Sort by Second DigitPractice · +10 XP · sorting, custom sorteasy
- Sort Even and Odd NumbersPractice · +10 XP · sorting, basiceasy
- Sort Students by ScorePractice · +10 XP · sorting, custom ordereasy
- Top Three ScoresPractice · +10 XP · heaps, sorting, top-keasy
- Count Unique Element PairsPractice · +20 XP · hash map, two pointers, sortingmedium
- Group by PropertyPractice · +20 XP · hash map, grouping, sortingmedium
- Maximize Non-overlapping IntervalsPractice · +20 XP · greedy, sortingmedium
- Maximum Non-overlapping IntervalsPractice · +20 XP · greedy, sorting, intervalsmedium
- Maximum Sum of Non-Overlapping SegmentsPractice · +20 XP · greedy, dynamic programming, sortingmedium
- Merge Overlapping IntervalsPractice · +20 XP · sorting, intervalsmedium
- Minimize Maximum DifferencePractice · +20 XP · binary search, greedy, sortingmedium
- Minimize Maximum Difference in PairsPractice · +20 XP · greedy, sorting, two pointersmedium
- Minimum Operations to Make Array SortedPractice · +20 XP · greedy, sorting, arraysmedium
- Pairs with Same ParityPractice · +20 XP · sorting, two pointers, combinatoricsmedium
- Sort by Custom PriorityPractice · +20 XP · sorting, custom sortingmedium
- Sort by Digit DifferencePractice · +20 XP · sorting, custom sorting, sorting then scanningmedium
- Sort by Digit GroupPractice · +20 XP · sorting, custom sorting, counting sortmedium
- Sort by Digit ProductPractice · +20 XP · sorting, custom sorting, sorting then scanningmedium
- Sort by Digit SumPractice · +20 XP · sorting, digit summedium
- Sort by Group SumPractice · +20 XP · sorting, custom sorting, groupingmedium
- Sort by Most Frequent DigitPractice · +20 XP · sorting, counting sortmedium
- Sort by Relative OrderPractice · +20 XP · sorting, custom sortmedium
- Sort by Subsequence SumPractice · +20 XP · sorting, hash map, prefix summedium
- Sort Students by Two CriteriaPractice · +20 XP · sorting, stable sortmedium
- Minimum Cost Path on a Grid with Custom Edge WeightsPractice · +30 XP · sorting, dijkstra, graphshard
Solve these free. Get paid in XP and Aura.
One tap with Google, no card. Every first accepted solve pays XP for the leaderboards and Aura for real goodies.
Other topics
Hash Map and Hashing101Arrays88Prefix Sums64SQL and Databases64Beginner Coding Problems60Graphs, BFS and DFS45Greedy41Sliding Window39Dynamic Programming37Math and Number Theory36Strings35Two Pointers35Stack29Binary Search25Simulation25Recursion22Linked List20Trees20Heap and Priority Queue18Matrix and Grid18Bit Manipulation18Queue and Deque16