classSolution:def__init__(self,nums: List[int]): self.nums = numsdefpick(self,target:int) ->int: k =1 res =Nonefor i, n inenumerate(self.nums):if n == target:if random.random()<1/k: res = i k +=1return res# Your Solution object will be instantiated and called as such:# obj = Solution(nums)# param_1 = obj.pick(target)