3
def __init__(self, nums: List[int]):5
# create a hash of values with their list of indices6
self.map = defaultdict(list)7
for i, v in enumerate(nums):10
def pick(self, target: int) -> int:11
return random.sample(self.map[target], 1)[0]15
for i in range(len(self.nums)):16
if self.nums[i] == target:18
if random.random() < 1/count:24
for i in range(len(self.nums)):25
if self.nums[i] == target:27
return (random.sample(samp,1))[0]31
# Your Solution object will be instantiated and called as such:33
# param_1 = obj.pick(target)