[Python3] faster than 97.5%,less memory than 75%,easy and short solution
The idea is to split range [0,N) into subranges,where delimeters are elements from blaclist.\nFor example if N=7,and blacklist =[2,4],we will got subranges [0,2
The idea is to split range [0,N) into subranges,where delimeters are elements from blaclist.\nFor example if N=7,and blacklist =[2,4],we will got subranges [0,2),[3,4),[5,7)\nAnd then we need to choose one subrange,for example [0,2),and generate random number with that range.\nThat solution is good because its light,but distirubution of random numbers is not equal,because one subrange can be much much greater than another one.\nWe can solve that if we add weight(probability to pick) to each subrange.\nIf you need any explanation,or you want i write solution using weights to pick element,just write comment below\n```\nclass Solution:\n    \n    def __init__(self, N: int, blacklist: List[int]):\n        \n        if len(blacklist)==0:\n            self.range = [[0,N]]\n            return\n        blacklist.sort()\n        self.range = []\n        prev = 0\n        \n        for black in blacklist:\n            if black-prev>0:\n                self.range.append([prev,black])\n            prev = black+1\n        if N-prev>0:\n            self.range.append([prev,N])\n\n    def pick(self) -> int:\n        e = random.choice(self.range)\n        return e[0]+int((e[1]-e[0])*random.random())       \n\n\n# Your Solution object will be instantiated and called as such:\n# obj = Solution(N, blacklist)\n# param_1 = obj.pick()\n```
[]