[Python3] hash solution using dict (92.28%)
Hash map blacklisted value in [0, N-len(blacklist)) to whitelisted value in [N-len(blacklist), N), and then randomly pick number in [0, N-len(blacklist)). \n\nf
Hash map blacklisted value in `[0, N-len(blacklist))` to whitelisted value in `[N-len(blacklist), N)`, and then randomly pick number in `[0, N-len(blacklist))`. \n```\nfrom random import randint\n\nclass Solution:\n\n    def __init__(self, N: int, blacklist: List[int]):\n        blacklist = set(blacklist)  #to avoid TLE\n        self.N = N - len(blacklist) #to be used in pick()\n        key = [x for x in blacklist if x < N-len(blacklist)]\n        val = [x for x in range(N-len(blacklist), N) if x not in blacklist]\n        self.mapping = dict(zip(key, val))\n\n    def pick(self) -> int:\n        i = randint(0, self.N-1)\n        return self.mapping.get(i, i)\n```\n
['Python3']