def __init__(self, nums):
self.nums = nums
def pick(self, target):
return random.choice([i for i,n in enumerate(self.nums) if n==target])
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.