Ordered Set LeetCode Problems: All 57, With Python Solutions
Every problem in this library that LeetCode tags Ordered Set — 57 in total, 47 of them with a complete Python solution, a worked example and the time and space complexity of the approach.
- 57 problems
- 1 Easy
- 20 Medium
- 36 Hard
Ordered Set problems by difficulty
Problems with a complete Python solution are listed first, then by ascending problem number.
Easy (1)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 2363 | Merge Similar Items | Easy | Array, Hash Table, Ordered Set +1 |
Medium (20)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 456 | 132 Pattern | Medium | Stack, Array, Binary Search +2 |
| 497 | Random Point in Non-overlapping Rectangles | Medium | Reservoir Sampling, Array, Math +4 |
| 729 | My Calendar I | Medium | Design, Segment Tree, Array +2 |
| 731 | My Calendar II | Medium | Design, Segment Tree, Array +3 |
| 855 | Exam Room | Medium | Design, Ordered Set, Heap (Priority Queue) |
| 1348 | Tweet Counts Per Frequency | Medium | Design, Hash Table, String +3 |
| 1418 | Display Table of Food Orders in a Restaurant | Medium | Array, Hash Table, String +2 |
| 1438 | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | Medium | Queue, Array, Ordered Set +3 |
| 1818 | Minimum Absolute Sum Difference | Medium | Array, Binary Search, Ordered Set +1 |
| 2034 | Stock Price Fluctuation | Medium | Design, Hash Table, Data Stream +2 |
| 2336 | Smallest Number in Infinite Set | Medium | Design, Hash Table, Ordered Set +1 |
| 2349 | Design a Number Container System | Medium | Design, Hash Table, Ordered Set +1 |
| 2353 | Design a Food Rating System | Medium | Design, Array, Hash Table +3 |
| 2424 | Longest Uploaded Prefix | Medium | Union Find, Design, Binary Indexed Tree +5 |
| 2762 | Continuous Subarrays | Medium | Queue, Array, Ordered Set +3 |
| 2817 | Minimum Absolute Difference Between Elements With Constraint | Medium | Array, Binary Search, Ordered Set |
| 635 | Design Log Storage SystemPremium | Medium | Design, Hash Table, String +1 |
| 1902 | Depth of BST Given Insertion OrderPremium | Medium | Tree, Binary Search Tree, Array +2 |
| 2021 | Brightest Position on StreetPremium | Medium | Array, Ordered Set, Prefix Sum +1 |
| 2031 | Count Subarrays With More Ones Than ZerosPremium | Medium | Binary Indexed Tree, Segment Tree, Array +5 |
Hard (36)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 218 | The Skyline Problem | Hard | Binary Indexed Tree, Segment Tree, Array +5 |
| 220 | Contains Duplicate III | Hard | Array, Bucket Sort, Ordered Set +2 |
| 315 | Count of Smaller Numbers After Self | Hard | Binary Indexed Tree, Segment Tree, Array +4 |
| 327 | Count of Range Sum | Hard | Binary Indexed Tree, Segment Tree, Array +4 |
| 352 | Data Stream as Disjoint Intervals | Hard | Union Find, Design, Hash Table +3 |
| 363 | Max Sum of Rectangle No Larger Than K | Hard | Array, Binary Search, Matrix +2 |
| 493 | Reverse Pairs | Hard | Binary Indexed Tree, Segment Tree, Array +4 |
| 699 | Falling Squares | Hard | Segment Tree, Array, Ordered Set |
| 715 | Range Module | Hard | Design, Segment Tree, Ordered Set |
| 732 | My Calendar III | Hard | Design, Segment Tree, Binary Search +2 |
| 850 | Rectangle Area II | Hard | Segment Tree, Array, Ordered Set +1 |
| 895 | Maximum Frequency Stack | Hard | Stack, Design, Hash Table +1 |
| 975 | Odd Even Jump | Hard | Stack, Array, Dynamic Programming +3 |
| 1606 | Find Servers That Handled Most Number of Requests | Hard | Array, Ordered Set, Simulation +1 |
| 1649 | Create Sorted Array through Instructions | Hard | Binary Indexed Tree, Segment Tree, Array +4 |
| 1675 | Minimize Deviation in Array | Hard | Greedy, Array, Ordered Set +1 |
| 1825 | Finding MK Average | Hard | Design, Queue, Data Stream +2 |
| 1847 | Closest Room | Hard | Array, Binary Search, Ordered Set +1 |
| 1912 | Design Movie Rental System | Hard | Design, Array, Hash Table +2 |
| 2035 | Partition Array Into Two Arrays to Minimize Sum Difference | Hard | Bit Manipulation, Array, Two Pointers +4 |
| 2102 | Sequentially Ordinal Rank Tracker | Hard | Design, Data Stream, Ordered Set +1 |
| 2179 | Count Good Triplets in an Array | Hard | Binary Indexed Tree, Segment Tree, Array +4 |
| 2213 | Longest Substring of One Repeating Character | Hard | Segment Tree, Array, String +1 |
| 2251 | Number of Flowers in Full Bloom | Hard | Array, Hash Table, Binary Search +3 |
| 2276 | Count Integers in Intervals | Hard | Design, Segment Tree, Ordered Set |
| 2382 | Maximum Segment Sum After Removals | Hard | Union Find, Array, Ordered Set +1 |
| 2426 | Number of Pairs Satisfying Inequality | Hard | Binary Indexed Tree, Segment Tree, Array +4 |
| 2612 | Minimum Reverse Operations | Hard | Breadth-First Search, Union Find, Array +2 |
| 2659 | Make Array Empty | Hard | Greedy, Binary Indexed Tree, Segment Tree +4 |
| 2713 | Maximum Strictly Increasing Cells in a Matrix | Hard | Memoization, Array, Hash Table +5 |
| 683 | K Empty SlotsPremium | Hard | Binary Indexed Tree, Segment Tree, Queue +5 |
| 716 | Max StackPremium | Hard | Stack, Design, Linked List +2 |
| 2158 | Amount of New Area Painted Each DayPremium | Hard | Segment Tree, Array, Ordered Set |
| 2254 | Design Video Sharing PlatformPremium | Hard | Stack, Design, Hash Table +1 |
| 2519 | Count the Number of K-Big IndicesPremium | Hard | Binary Indexed Tree, Segment Tree, Array +4 |
| 2613 | Beautiful PairsPremium | Hard | Geometry, Array, Math +3 |
Keep exploring
All LeetCode topicsEvery tag with a page of its own, with the number of problems behind each.LeetCode patternsThe techniques themselves, with a Python template and complexity for each.Curated study listsBlind 75, NeetCode 150 and three more, grouped by pattern.Easy problemsStart here when the data structure is new rather than the problem.
Other topics
- Array1,569
- String672
- Hash Table588
- Math485
- Dynamic Programming481
- Sorting392
- Greedy346
- Depth-First Search289
- Binary Search253
- Database249
- Tree225
- Breadth-First Search223
- Matrix216
- Two Pointers201
- Bit Manipulation194
- Binary Tree174
- Heap (Priority Queue)163
- Prefix Sum157
- Stack157
- Simulation144
- Graph138
- Counting126
- Design122
- Sliding Window116
When the Ordered Set problem arrives live
Stealth Interview is a desktop app for macOS and Windows. It reads the coding problem off your screen, returns a working solution with a step-by-step explanation and its time and space complexity, and transcribes what the interviewer is saying — while staying invisible to screen sharing.