Python HashMap O(B) and O(1)
\nclass Solution:\n\n    def __init__(self, N, blacklist):\n        """\n        :type N: int\n        :type blacklist: List[int]\n        """\n        self.N, 
```\nclass Solution:\n\n    def __init__(self, N, blacklist):\n        """\n        :type N: int\n        :type blacklist: List[int]\n        """\n        self.N, self.N_b = N, len(blacklist)\n        self.map = {}\n        self.black = set(blacklist)\n        cur_white = self.N - self.N_b\n        for b in self.black:\n            if b < self.N - self.N_b:\n                while cur_white in self.black:\n                    cur_white += 1\n                self.map[b] = cur_white\n                cur_white += 1\n\n    def pick(self):\n        """\n        :rtype: int\n        """\n        k = random.randint(0, self.N-self.N_b - 1)     \n        return self.map[k] if k in self.black else k\n\n        \n        \n\n\n# Your Solution object will be instantiated and called as such:\n# obj = Solution(N, blacklist)\n# param_1 = obj.pick()\n```
[]