710. Random Pick with Blacklist - Beats 100%
Complexity\n- Time complexity:\n Add your time complexity here, e.g. O(n) \n O(1) \n\n---\n\n- Space complexity:\n Add your space complexity here, e.g. O(n) \nO
# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n ***$$O(1)$$*** \n\n---\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n\n---\n\n# Code\n```\nk = 10\nclass Solution:\n    def __init__(self, n: int, blacklist: List[int]):\n        self.data = []\n        black = {}\n        if len(blacklist) == 1:\n            n = min(n, k)\n        if len(blacklist) != 0 and min(blacklist) > k:\n            n = min(n, k)\n        for ele in blacklist:\n            black[ele] = True\n        for i in range(0, n):\n            if black.get(i) is None:\n                self.data.append(i)\n        self.index = 0\n    def pick(self) -> int:\n        k = self.data[self.index]\n        self.index += 1\n        if self.index == len(self.data):\n            self.index = 0\n        return k\n        \n```
['Array', 'Hash Table', 'Randomized', 'Python3']