Available question text
Given n and a blacklist of unique integers, design a data structure that returns a uniformly random integer from [0, n-1] excluding the blacklist while minimizing calls to the built-in random generator. Preprocess efficiently (using about O(blacklist.size) extra space) so picks can be done in O(1) time by compacting the valid values and remapping sampled indices.
Related questions
Continue with questions that share topics or the same question type.
- Random Pick Index
Coding
- Random Pick with Weight
Coding · Array · Binary Search · Math
- Clone Binary Tree With Random Pointer
Coding
- Copy List with Random Pointer
Coding · Hash Table · Linked List
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
Google
Leetcode 710. Random Pick with Blacklist
Reported Aug 1, 2026 · 1 source report
MID_LEVEL
Source snapshot: Nov 12, 2026
View source