Randomized LeetCode Problems: All 12, With Python Solutions
Every problem in this library that LeetCode tags Randomized — 12 in total, 12 of them with a complete Python solution, a worked example and the time and space complexity of the approach.
- 12 problems
- 0 Easy
- 9 Medium
- 3 Hard
Randomized problems by difficulty
Problems with a complete Python solution are listed first, then by ascending problem number.
Medium (9)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 380 | Insert Delete GetRandom O(1) | Medium | Design, Array, Hash Table +2 |
| 382 | Linked List Random Node | Medium | Reservoir Sampling, Linked List, Math +1 |
| 384 | Shuffle an Array | Medium | Design, Array, Math +1 |
| 398 | Random Pick Index | Medium | Reservoir Sampling, Hash Table, Math +1 |
| 470 | Implement Rand10() Using Rand7() | Medium | Math, Rejection Sampling, Probability and Statistics +1 |
| 478 | Generate Random Point in a Circle | Medium | Geometry, Math, Rejection Sampling +1 |
| 497 | Random Point in Non-overlapping Rectangles | Medium | Reservoir Sampling, Array, Math +4 |
| 519 | Random Flip Matrix | Medium | Reservoir Sampling, Hash Table, Math +1 |
| 528 | Random Pick with Weight | Medium | Array, Math, Binary Search +2 |
Hard (3)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 381 | Insert Delete GetRandom O(1) - Duplicates allowed | Hard | Design, Array, Hash Table +2 |
| 710 | Random Pick with Blacklist | Hard | Array, Hash Table, Math +3 |
| 1515 | Best Position for a Service Centre | Hard | Geometry, Array, Math +1 |
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 Randomized 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.