Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 398. Random Pick Index
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.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Late October, 2025
Meta
Senior
Mid May, 2025
Meta
Senior
Early March, 2025
Meta
Senior
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.