Problems
Callback's own problems and the LeetCode questions companies have been asking, in one place — pick a category, then filter by company, frequency, status, difficulty, topic, and language.
- Randomized15
- Array1842
- String778
- Hash Table749
- Math565
- Dynamic Programming534
- Sorting483
- Greedy401
- Depth-First Search338
- Binary Search305
- Matrix267
- Breadth-First Search261
Algorithms & Data Structures · One pass and O(k) memory: item i replaces a random slot with probability k/(i+1).
Weighted Sampling Without Replacement
Algorithms & Data Structures · A-Res: key each item by random()^(1/weight) and keep the k largest keys.
Stratified Sampling with Largest-Remainder Allocation
Algorithms & Data Structures · Floor each proportional share, give leftovers to the largest remainders, sample within each stratum.
Asked on LeetCode
12 questions tagged Randomized · all time
- Insert Delete GetRandom O(1)mediumArrayHash TableMathDesign+124 companies
- Random Pick with WeightmediumArrayMathBinary SearchPrefix Sum+116 companies
- Insert Delete GetRandom O(1) - Duplicates allowedhardArrayHash TableMathDesign+110 companies
- Shuffle an ArraymediumArrayMathDesignRandomized5 companies
- Random Pick IndexmediumHash TableMathReservoir SamplingRandomized4 companies
- Implement Rand10() Using Rand7()mediumMathRejection SamplingRandomizedProbability and Statistics4 companies
- Random Pick with BlacklisthardArrayHash TableMathBinary Search+23 companies
- Linked List Random NodemediumLinked ListMathReservoir SamplingRandomized3 companies
- Random Point in Non-overlapping RectanglesmediumArrayMathBinary SearchReservoir Sampling+32 companies
- Best Position for a Service CentrehardArrayMathGeometryRandomized1 company
- Random Flip MatrixmediumHash TableMathReservoir SamplingRandomized1 company
- Generate Random Point in a CirclemediumMathGeometryRejection SamplingRandomized1 company
Listings only — titles, difficulty, and tags link out to LeetCode. Imported from the leetcode-company-wise-problems snapshot dated 1 June 2025. Frequency is that dataset's own relative score within a company and time range.