Available question text
Given an array with duplicates, implement a Solution class whose pick(target) method returns a uniformly random index i such that nums[i] == target. Must support many pick calls (array length up to 2×10^4, picks up to 10^4); common approaches are pre-indexing indices per value or using reservoir sampling for equal-probability selection.
Related questions
Continue with questions that share topics or the same question type.
- Random Pick with Blacklist
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
Meta
Leetcode 398. Random Pick Index
Reported Jan 8, 2026 · 5 source reports
MID_LEVEL, SENIOR
Source snapshot: Nov 12, 2026
View source